def keyPressEvent(self, event): if event.key() == Qt.Key_A and QApplication.keyboardModifiers() == ( Qt.ControlModifier | Qt.ShiftModifier): print('Ctrl+Shift+A') if Util.isWindows(): from lib.Screenshot import capture capture()
def changeEvent(self, e): if e.type() == QEvent.WindowStateChange: if self.isMinimized() and Util.isWindows(): if self.settings["chkMinToTray"]: self.hide() elif self.isMaximized(): pass elif self.isFullScreen(): pass elif self.isActiveWindow(): pass elif e.type() == QEvent.ActivationChange: #self.repaint() pass
def loadData(self, splash=None): self._widget.loadUrl(Util.getConfigValue('url')) if Util.isWindows(): self.addSystemTray() #check upgrade mainScript = Util.getScriptName() t1 = threading.Thread(target=self.updater.checkUpgrade, args=(False, mainScript)) t1.setDaemon(True) t1.start() #splash if splash: splash.showMessage("Loading... 100%", Qt.AlignHCenter | Qt.AlignBottom, Qt.white) qApp.processEvents()
sys.excepthook = errorHandler #main if __name__ == '__main__': #scale if Util.isNewSystem(): QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) if Util.isNewSystem(): app.setAttribute(Qt.AA_EnableHighDpiScaling) app.setQuitOnLastWindowClosed(False) dlg = MainWindow() #single instance if Util.isWindows() and Util.isNewSystem(): import win32con, win32file, pywintypes LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK LOCK_SH = 0 LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY __overlapped = pywintypes.OVERLAPPED() pid_dir = dlg.tmpPath self_name = os.path.basename( sys.argv[0])[0:os.path.basename(sys.argv[0]).rfind('.')] if os.path.exists(pid_dir): try: fd = open(pid_dir + '/' + self_name + '.pid', 'w') hfile = win32file._get_osfhandle(fd.fileno()) win32file.LockFileEx(hfile, LOCK_EX | LOCK_NB, 0, 0xffff0000,