def setWmClass(self, name, widget): ''' @param: name QString @param: widget QWidget ''' if const.APP_WS_X11: if QGuiApplication.platformName() != 'xcb': return
def onDataChanged(self): txt = QGuiApplication.clipboard().text() if txt is not None or len(txt) == 0: self.newClpbdTextData.emit(str(txt))
"%22+AND+%28%28%22%7B%22+OR+%22%3A%22+OR+%22%28%22+OR+%22%5B%22%29+OR+%28%22function%28%22+OR+%22def%22+OR+%22void%22+OR+%22int%22+OR+%22string%22%29++OR+%28%22class%22+OR+%22new%22%29%29" ).read()) def githubget(q, p, repo_part): base_url = 'http://readthedocs.org/api/v1/project/' + p try: repo_part = json.loads(urlopen(base_url).read())['repo'].replace( "http://github.com", "").strip("/") except: return "<h3>No results, sorry.</h3>" html = searchRepo(q, p, repo_part, base_url=base_url) output = format_github(html, repo_part) categorise(output, q) output = '<div onMouseOver=\"this.style.backgroundColor = \'#FFF0FF\';\" onMouseOut=\"this.style.backgroundColor = \'#FFFFFF\';\">' + output + '</div>' return output app = QApplication(sys.argv) myS = "<p>start</p>" webview = MyWebView() ledit = MyLineEdit(webview) ledit.setFixedSize(100, 40) ledit.setEnabled(True) ledit.setVisible(True) ledit.inputTyped.connect(webview.handleText) QGuiApplication.clipboard().dataChanged.connect(webview.onDataChanged) webview.newClpbdTextData.connect(ledit.handleClpbrdText) webview.show() app.exec_()
def __init__(self, parent=None): ''' @param parent QWidget ''' super().__init__(parent) self._ui = uic.loadUi('mc/preferences/UserAgentDialog.ui', self) self._manager = gVar.app.userAgentManager() # UserAgentManager self._knownUserAgents = [] # QStringList self.setAttribute(Qt.WA_DeleteOnClose) self._ui.globalComboBox.setLayoutDirection(Qt.LeftToRight) self._ui.table.setLayoutDirection(Qt.LeftToRight) # QString os = gVar.appTools.operatingSystemLong() if const.OS_UNIX: if QGuiApplication.platformName() == 'xcb': os += 'X11; ' elif QGuiApplication.platformName() == 'wayland': os += 'Wayland; ' chromeRx = re.compile(r'Chrome/([^\s]+)') dUserAgent = self._manager.defaultUserAgent() chromeVersion = chromeRx.search(dUserAgent).groups()[0] self._knownUserAgents.extend([ "Opera/9.80 (%s) Presto/2.12.388 Version/12.16" % os, "Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36" % (os, chromeVersion), "Mozilla/5.0 (%s) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12" % os, "Mozilla/5.0 (%s; rv:57.0) Gecko/20100101 Firefox/57.0" % os, ]) self._ui.globalComboBox.addItems(self._knownUserAgents) # QString globalUserAgent = self._manager.globalUserAgent() self._ui.changeGlobal.setChecked(bool(globalUserAgent)) self._ui.globalComboBox.lineEdit().setText(globalUserAgent) self._ui.globalComboBox.lineEdit().setCursorPosition(0) self._ui.changePerSite.setChecked(self._manager.usePerDomainUserAgents()) for siteItem, userAgentItem in self._manager.perDomainUserAgentsList(): row = self._ui.table.rowCount() self._ui.table.insertRow(row) self._ui.table.setItem(row, 0, siteItem) self._ui.table.setItem(row, 1, userAgentItem) self._ui.table.sortByColumn(-1, Qt.AscendingOrder) self._ui.add.clicked.connect(self._addSite) self._ui.remove.clicked.connect(self._removeSite) self._ui.edit.clicked.connect(self._editSite) self._ui.table.clicked.connect(self._editSite) self._ui.changeGlobal.clicked.connect(self._enableGlobalComboBox) self._ui.changePerSite.clicked.connect(self._enablePerSiteFrame) self._enableGlobalComboBox(self._ui.changeGlobal.isChecked()) self._enablePerSiteFrame(self._ui.changePerSite.isChecked())
def __init__(self, planHeatDMM): """ Dialog Constructor""" super(FieldUserMapDialog, self).__init__(None) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self) try: palette = QGuiApplication.palette() self.brush = palette.windowText() self.shapeFormat = { 'N': 'Number', 'C': 'String', 'D': 'Date', 'L': 'Boolean', 'F': 'Float' } self.previousValueList = [] self.setWindowIcon( QtGui.QIcon(planHeatDMM.plugin_dir + os.path.sep + 'resources/logo.ico')) #self.setWindowFlags(self.windowFlags() & QtCore.Qt.WindowMinimizeButtonHint) self.setWindowModality(QtCore.Qt.ApplicationModal) self.setFixedSize(600, 380) self.planHeatDMM = planHeatDMM self.refreshToolButton.setIcon( planHeatDMM.resources.icon_refresh_icon) self.deleteToolButton.setIcon(planHeatDMM.resources.icon_del_icon) self.deleteAllToolButton.setIcon( planHeatDMM.resources.icon_trash_icon) self.addFieldsToolButton.setIcon( planHeatDMM.resources.icon_add_icon) self.refreshToolButton.clicked.connect(self.refreshRecordsTable) self.deleteToolButton.clicked.connect(self.deleteRecordTable) self.deleteAllToolButton.clicked.connect( self.deleteAllRecordsTable) self.fieldUserMapTable.horizontalHeader().sectionClicked.connect( self.clickAllRows) self.userSHPFieldMapCheckBox.stateChanged.connect( self.shapeFieldCheckBoxStateChanged) self.addFieldsToolButton.clicked.connect( self.openShapeUserFieldDialog) self.addAllFieldsButton.clicked.connect(self.addAllFields) self.addFieldsToolButton.setVisible( self.planHeatDMM.data.boolAddShapeFields) self.userSHPFieldMapCheckBox.setChecked( self.planHeatDMM.data.boolAddShapeFields) self.fieldUserMapTable.installEventFilter(self) self.setSystemDependantFontSize() self.setHeaders() self.addRecordsTable() except: self.planHeatDMM.resources.log.write_log( "ERROR", "FieldUserMapDialog - Constructor Unexpected error:" + str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1])) showErrordialog( self.planHeatDMM.dlg, "FieldUserMapDialog - Constructor Unexpected error:", str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1])) raise
HttpClient.disk_serial_number = disk_info[0] def check_database(data_name): if not os.path.exists(sys.path[0] + '/database/' + data_name + '.db'): ClientDatabase.init_database() if __name__ == '__main__': #os.system("taskkill /f /im explorer.exe") path = sys.path[0] + '/qml/' if os.name == 'nt': path = 'qml/' slot_handler = SlotHandler() app = QGuiApplication(sys.argv) view = QQuickView() context = view.rootContext() translator = QTranslator() context.setContextProperty("slot_handler", slot_handler) translator.load(path + 'first.qm') app.installTranslator(translator) view.engine().quit.connect(app.quit) view.setSource(QUrl(path + 'Main.qml')) signal_handler() #app.setOverrideCursor(Qt.BlankCursor) #view.setFlags(Qt.WindowFullscreenButtonHint) #view.setFlags(Qt.FramelessWindowHint) #view.resize(1023, 768)
def test(): from PyQt5.QtWidgets import QApplication app = QGuiApplication([]) _app = QApplication([]) win = PyLintGui() win.show()