From b06edbc91ddb2eec46488f4467f296ebae1dfac3 Mon Sep 17 00:00:00 2001 From: Et0h Date: Tue, 7 Jul 2015 20:35:30 +0100 Subject: [PATCH] Add icons when file switch is possible --- resources/film_go.png | Bin 0 -> 813 bytes resources/world_go.png | Bin 0 -> 944 bytes syncplay/constants.py | 6 +++++ syncplay/ui/gui.py | 52 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 resources/film_go.png create mode 100644 resources/world_go.png diff --git a/resources/film_go.png b/resources/film_go.png new file mode 100644 index 0000000000000000000000000000000000000000..dd0168ea92e50f4c56768a8a4307774445448f4a GIT binary patch literal 813 zcmV+|1JeA7P)s+KnkY`Eo6h&V=bWA+7NR@wyLq4U|DET3pYsaU)z#lsRm~+9=1NbpotRP@QR?BSgMY-(!CUtKd&Fi%mGr^Lm|%1SMffWkU;#IdzCBL&UGNwUk% z3w3;hXa?gNmU=Q(-80<)DkYZ9q5-ko%lN?eIUdbj+ zNQ|)`L?h9?t^*3D5`Kc)lD^?%tP?)NJ&4LSybYf~_iP~;JICqkrwCgjflLIcSm-hX zC7Z06WmSkScoB}2V{qQ7?_VYKcURCGd(G=TlEDO~ z(CBCi0p}ZRwi-}gR@J|x$~&{u^2NTfu7%?dax5>aMwTT;I$0A5atT96>=BBk3YfJF zh@+)=F+%g#I1b!O-j!j`Lw@>R%*SKs{{1;xde?4ixgL({f}|CJkYXH0d-x8DlCQz4 zG8`#53q@0*s0vhQ7>|siFmpemY*G9g`VjHn7VY{LBE)mzioa$e3H2M{(9cMCAqXOR#lX@1Tgnr->YYTBeqS6v!3>T6kRG3WqCo3x$(B3 zLi6Ce2?`$`uhseluh-j80yoh!G&JN(G)7612HZE7ww8Df;r(Fq7~K;+Jh1#9Xj;Mx rxbAV+2r)%9SQb^qJz1*-|E>Q8ss6iyye%@B00000NkvXXu0mjfIy`F+ literal 0 HcmV?d00001 diff --git a/resources/world_go.png b/resources/world_go.png new file mode 100644 index 0000000000000000000000000000000000000000..aee9c97f8232fd21bdd23804c83eb721ff597a96 GIT binary patch literal 944 zcmV;h15f;kP)Vt{;GNX|PV@wQxfRAQ-FeWBO z_okAVsCzMc+6+1!88|n0#f5DY;>y+0w55ffp3Cpz=VNHC0RRA)nx7m4J_e2fEr1D> zf$Li7b6<{q_X_|3fT6VpU}}ES1g3#EU(cKfCPFP#tOhI>gtQSn;qulcA%*-^2>JFm zr+(T4FtpZ8%})k^KL(S1BPTO2QL%$KxGYx;>U5BTrO?79gvFL~m7AM47lbE{|M1p@ zvJU{5KHA(pGTJssQM!0O10j6WL>(4&6rCX3c8K+IfcD4>45pqv>^k0$0RGbW>L~Ep z>F(G3_hpqWYSffq&yG-Z0#t0sZtPO7RtY8w81XE_$%9;8ywUmn_33;5p~)j(OtcLh zGW;R7d;;`7T4jV=PyEzuAB!7%sQMDYjz>7LEO}MJEJ+SEXMDFFKWs9AW0_c*yVfT8 zdLO<111JQ!Z5P|F5l?92}SW-(dg4!8-@ngsi3V^Oiyy@FAt+W#MZLO z+G>n8Cxq}c`;$Ecm+#=&HP9L%gkegdiWRq#ZuU14t$&X7yov1vXjLB(4@;a4kKLRg z-PA=-YKUFC%EJ2Z6sr?Rp~|N4#O=q$)pS=l!*Bo1(-`ie&YwXjm+`*$kXj*?M4{O% zuhGAMggv*$Cl@{hx*zyFSA6yJ!&%W0X~DEMC>Q=Dk#Mkui`0r-AY6 ziYp9c#&{<6JiCE=qrPunJwM|*-o=^4Szb&J5cfBbh$w7fBc$M|SUag$2d(i=0{##! z(KNT$=DD_V!?IjrCV=O7?_9~=opWmL;fW*1d9-cvk8qg2_BpO{v4zWlWG};=C;2-! z$Cag7CoJ20md|EuhSnN@SH6BZDm-yscyj#Rk@rnx3a!H!K7(Yu!lxHc)7Lu8)up-J z2HoDfaAs*8z|dL)001y@X6Owm") + def getFileSwitchState(self, filename): + if filename: + if self._syncplayClient.userlist.currentUser.file and filename == self._syncplayClient.userlist.currentUser.file['name']: + return constants.FILEITEM_SWITCH_NO_SWITCH + if isURL(filename): + return constants.FILEITEM_SWITCH_FILE_SWITCH + else: + currentPath = self._syncplayClient.userlist.currentUser.file["path"] if self._syncplayClient.userlist.currentUser.file else None + if currentPath: + currentDirectory = os.path.dirname(currentPath) + newPath = os.path.join(currentDirectory, filename) + if os.path.isfile(newPath): + return constants.FILEITEM_SWITCH_FILE_SWITCH + else: + return constants.FILEITEM_SWITCH_NO_SWITCH + else: + return constants.FILEITEM_SWITCH_NO_SWITCH + return constants.FILEITEM_SWITCH_NO_SWITCH + def showUserList(self, currentUser, rooms): self._usertreebuffer = QtGui.QStandardItemModel() self._usertreebuffer.setHorizontalHeaderLabels( @@ -157,6 +199,8 @@ class MainWindow(QtGui.QMainWindow): filesizeitem = QtGui.QStandardItem(formatSize(user.file['size'])) filedurationitem = QtGui.QStandardItem("({})".format(formatTime(user.file['duration']))) filenameitem = QtGui.QStandardItem((user.file['name'])) + fileSwitchState = self.getFileSwitchState(user.file['name']) if room == currentUser.room else None + filenameitem.setData(fileSwitchState, Qt.UserRole + constants.FILEITEM_SWITCH_ROLE) if currentUser.file: sameName = sameFilename(user.file['name'], currentUser.file['name']) sameSize = sameFilesize(user.file['size'], currentUser.file['size'])