Beispiel #1
0
def on_systray_activated(tray):
    buttons = qApp.mouseButtons()
    if buttons & QtCore.Qt.RightButton:
        qApp.quit()
    if buttons & QtCore.Qt.LeftButton:
        cycle_through_layouts()
        change_tray_icon(tray)
Beispiel #2
0
    def localTableDoubleClicked(self, index):
        if qApp.mouseButtons() == Qt.RightButton:
            return

        if os.path.isdir(
                os.path.join(
                    self.localPath,
                    self.localFileTable[index.row()].text(0))) == False:
            return

        if index.row() == 0:
            if self.localPath == '/':
                self.localPath = self.localPath + self.localFileTable[0].text(
                    0)
            else:
                tempPath = self.localPath.split('/')[:-1]
                self.localPath = ''
                for i in tempPath:
                    self.localPath = self.localPath + '/' + i
                if self.localPath != '/':
                    self.localPath = self.localPath[1:]
        else:
            self.localPath = os.path.join(
                self.localPath, self.localFileTable[index.row()].text(0))

        self.localFileRefesh()
Beispiel #3
0
    def serverTableDoubleClicked(self, index):
        if qApp.mouseButtons() == Qt.RightButton:
            return

        if self.serverFileInfo[index.row()].text(1) == 'File':
            return

        if index.row() == 0:
            if self.serverPath == '/':
                self.localPath = self.serverPath + self.serverFileInfo[0].text(
                    0)
            else:
                tempPath = self.serverPath.split('/')[:-1]
                self.serverPath = ''
                for i in tempPath:
                    self.serverPath = self.serverPath + '/' + i
                if self.serverPath != '/':
                    self.serverPath = self.serverPath[1:]
        else:
            self.serverPath = os.path.join(
                self.serverPath, self.serverFileInfo[index.row()].text(0))

        self.serverFileTable.clear()
        self.serverFileInfo.clear()

        if self.serverPath != '/':
            node = QTreeWidgetItem(self.serverFileTable)
            node.setText(0, '..')
            self.serverFileInfo.append(node)

        self.serverFileTableRefresh()
Beispiel #4
0
 def showMainfromTray(self):
     buttons = qApp.mouseButtons()
     if buttons == Qt.LeftButton:
         if self.isVisible() == False:
             self.showWinAction.setText("Hauptfenster verbergen")
             self.setVisible(True)
         elif self.isVisible() == True:
             self.showWinAction.setText("Hauptfenster anzeigen")
             self.setVisible(False)
Beispiel #5
0
    def localTableRightClicked(self, item, int_p):
        if item.text(0) == '..':
            return
        if qApp.mouseButtons() == Qt.RightButton:
            localMenu = QMenu()
            upLoadFile = QAction('upload')
            upLoadFolder = QAction('uploadfolder')
            upLoadFile.triggered.connect(self.uploadFile)
            upLoadFolder.triggered.connect(self.uploadFolder)
            if item.text(2) == 'Folder':
                localMenu.addAction(upLoadFolder)
            else:
                localMenu.addAction(upLoadFile)

            localMenu.exec_(QCursor.pos())
Beispiel #6
0
    def serverTableRightClicked(self, item, int_p):
        if item.text(0) == '..':
            return
        if qApp.mouseButtons() == Qt.RightButton:
            serverMenu = QMenu()
            downLoadFile = QAction('download')
            downLoadFolder = QAction('downloadfolder')
            downLoadFile.triggered.connect(self.downloadFile)
            downLoadFolder.triggered.connect(self.downloadFolder)
            if item.text(1) == 'Folder':
                serverMenu.addAction(downLoadFolder)
            else:
                serverMenu.addAction(downLoadFile)

            serverMenu.exec_(QCursor.pos())
Beispiel #7
0
    def on_systray_activated():
        buttons = qApp.mouseButtons()
        if not buttons:
            msgBox = QMessageBox()
            msgBox.setWindowTitle('Exit')
            msgBox.setText('Are you sure to quit?')
            msgBox.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
            msgBox.setIcon(QMessageBox.Information)
            msgBox.setDefaultButton(QMessageBox.No)
            msgBox.setWindowIcon(QIcon('image/icon.png'))
            msgBox.setWindowFlags(Qt.WindowStaysOnTopHint)
            msgBox.setWindowFlags(msgBox.windowFlags()
                                  & ~Qt.WindowCloseButtonHint
                                  & ~Qt.WindowMaximizeButtonHint
                                  & ~Qt.WindowMinimizeButtonHint)
            msgBox.activateWindow()
            msgBox.raise_()
            result = msgBox.exec_()

            if result == QMessageBox.Yes:
                WifiServer.EXIT = True
                quit(0)
                sys.exit(0)