def __init__(self, bookmarksManager, node, newValue, title): """ Constructor @param bookmarksManager reference to the bookmarks manager (BookmarksManager) @param node reference to the node to be changed (BookmarkNode) @param newValue new value to be set (string) @param title flag indicating a change of the title (True) or the URL (False) (boolean) """ super(ChangeBookmarkCommand, self).__init__() self._bookmarksManager = bookmarksManager self._title = title self._newValue = newValue self._node = node if self._title: self._oldValue = self._node.title self.setText(QCoreApplication.translate( "BookmarksManager", "Name Change")) else: self._oldValue = self._node.url self.setText(QCoreApplication.translate( "BookmarksManager", "Address Change"))
def getImporterInfo(id): """ Module function to get information for the given source id. @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), a prompt (string) and the default directory of the bookmarks file (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "opera": if Globals.isWindowsPlatform(): standardDir = os.path.expandvars("%APPDATA%\\Opera\\Opera") elif Globals.isMacPlatform(): standardDir = os.path.expanduser( "~/Library/Opera") else: standardDir = os.path.expanduser("~/.opera") return ( UI.PixmapCache.getPixmap("opera.png"), "Opera", "bookmarks.adr", QCoreApplication.translate( "OperaImporter", """Opera stores its bookmarks in the <b>bookmarks.adr</b> """ """text file. This file is usually located in"""), QCoreApplication.translate( "OperaImporter", """Please choose the file to begin importing bookmarks."""), standardDir, ) else: raise ValueError("Unsupported browser ID given ({0}).".format(id))
def __downloadFile(self, type_, fileName, timestamp): """ Private method to downlaod the given file. @param type_ type of the synchronization event (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial") @param fileName name of the file to be downloaded (string) @param timestamp time stamp in seconds of the file to be downloaded (integer) """ self.syncStatus.emit(type_, self._messages[type_]["RemoteExists"]) try: f = open(os.path.join(Preferences.getHelp("SyncDirectoryPath"), self._remoteFiles[type_]), "rb") data = f.read() f.close() except IOError as err: self.syncStatus.emit( type_, self.tr("Cannot read remote file.\n{0}").format(str(err))) self.syncFinished.emit(type_, False, True) return QCoreApplication.processEvents() ok, error = self.writeFile(QByteArray(data), fileName, type_, timestamp) if not ok: self.syncStatus.emit(type_, error) self.syncFinished.emit(type_, ok, True)
def expression_iterator(self, layer, expression, geometryStorage): featReq = QgsFeatureRequest() expression = QgsExpression(expression) context = QgsExpressionContext() self.stopLoop = False i = 0 for f in layer.getFeatures(featReq): QCoreApplication.processEvents() if self.stopLoop: break self.recordingSearchProgress.emit(i) i += 1 context.setFeature(f) evaluated = unicode(expression.evaluate(context)) if expression.hasEvalError(): continue if f.geometry() is None or f.geometry().centroid() is None: continue centroid = f.geometry().centroid().asPoint() if geometryStorage == 'wkb': geom = binascii.b2a_hex(f.geometry().asWkb()) elif geometryStorage == 'wkt': geom = f.geometry().exportToWkt() elif geometryStorage == 'extent': geom = f.geometry().boundingBox().asWktPolygon() yield ( evaluated, centroid.x(), centroid.y(), geom )
def masterPasswordChanged(self, oldPassword, newPassword): """ Public slot to handle the change of the master password. @param oldPassword current master password (string) @param newPassword new master password (string) """ if not self.__loaded: self.__load() progress = E5ProgressDialog( self.tr("Re-encoding saved passwords..."), None, 0, len(self.__logins), self.tr("%v/%m Passwords"), QApplication.activeModalWidget()) progress.setMinimumDuration(0) progress.setWindowTitle(self.tr("Passwords")) count = 0 for key in self.__logins: progress.setValue(count) QCoreApplication.processEvents() username, hash = self.__logins[key] hash = Utilities.crypto.pwRecode(hash, oldPassword, newPassword) self.__logins[key] = (username, hash) count += 1 progress.setValue(len(self.__logins)) QCoreApplication.processEvents() self.changed.emit()
def __init__(self, vcs, parent=None): """ Constructor @param vcs reference to the vcs object @param parent parent widget (QWidget) """ super(HgTagBranchListDialog, self).__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) self.vcs = vcs self.tagsList = None self.allTagsList = None self.__hgClient = vcs.getClient() self.tagList.headerItem().setText(self.tagList.columnCount(), "") self.tagList.header().setSortIndicator(3, Qt.AscendingOrder) if self.__hgClient: self.process = None else: self.process = QProcess() self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) self.process.readyReadStandardError.connect(self.__readStderr) self.show() QCoreApplication.processEvents()
def __uploadFile(self, type_, fileName): """ Private method to upload the given file. @param type_ type of the synchronization event (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial") @param fileName name of the file to be uploaded (string) """ QCoreApplication.processEvents() data = self.readFile(fileName, type_) if data.isEmpty(): self.syncStatus.emit(type_, self._messages[type_]["LocalMissing"]) self.syncFinished.emit(type_, False, False) return else: try: f = open(os.path.join(Preferences.getHelp("SyncDirectoryPath"), self._remoteFiles[type_]), "wb") f.write(bytes(data)) f.close() except IOError as err: self.syncStatus.emit( type_, self.tr("Cannot write remote file.\n{0}").format( str(err))) self.syncFinished.emit(type_, False, False) return self.syncFinished.emit(type_, True, False)
def getImporterInfo(id): """ Module function to get information for the given source id. @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), a prompt (string) and the default directory of the bookmarks file (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "ie": if Globals.isWindowsPlatform(): standardDir = os.path.expandvars( "%USERPROFILE%\\Favorites") else: standardDir = "" return ( UI.PixmapCache.getPixmap("internet_explorer.png"), "Internet Explorer", "", QCoreApplication.translate( "IExplorerImporter", """Internet Explorer stores its bookmarks in the""" """ <b>Favorites</b> folder This folder is usually""" """ located in"""), QCoreApplication.translate( "IExplorerImporter", """Please choose the folder to begin importing bookmarks."""), standardDir, ) else: raise ValueError("Unsupported browser ID given ({0}).".format(id))
def advance(self): self._line += 1 if self._line < len(self._lyrics): self._target.write(self._lyrics[self._line]) else: QCoreApplication.instance().quit()
def __init__(self, filepath=None): QObject.__init__(self) QTimer.singleShot(0, self.__launchTimerTimedOut) self.prefs = Preferences() self.prefs.load() global APP_PREFS APP_PREFS = self.prefs locale = QLocale.system() dateFormat = self.prefs.dateFormat decimalSep = locale.decimalPoint() groupingSep = locale.groupSeparator() cachePath = QStandardPaths.standardLocations(QStandardPaths.CacheLocation)[0] DateEdit.DATE_FORMAT = dateFormat self.model = MoneyGuruModel( view=self, date_format=dateFormat, decimal_sep=decimalSep, grouping_sep=groupingSep, cache_path=cachePath ) self.mainWindow = MainWindow(app=self) self.preferencesPanel = PreferencesPanel(self.mainWindow, app=self) self.aboutBox = AboutBox(self.mainWindow, self) self.initialFilePath = None if filepath and op.exists(filepath): self.initialFilePath = filepath elif self.prefs.recentDocuments: self.initialFilePath = self.prefs.recentDocuments[0] self.finishedLaunching.connect(self.applicationFinishedLaunching) QCoreApplication.instance().aboutToQuit.connect(self.applicationWillTerminate)
def __init__(self, filepath=None): ApplicationBase.__init__(self) self.prefs = Preferences() self.prefs.load() global APP_PREFS APP_PREFS = self.prefs locale = QLocale.system() dateFormat = self.prefs.dateFormat decimalSep = locale.decimalPoint() groupingSep = locale.groupSeparator() cachePath = QStandardPaths.standardLocations(QStandardPaths.CacheLocation)[0] appdata = getAppData() DateEdit.DATE_FORMAT = dateFormat self.model = MoneyGuruModel( view=self, date_format=dateFormat, decimal_sep=decimalSep, grouping_sep=groupingSep, cache_path=cachePath, appdata_path=appdata, ) # on the Qt side, we're single document based, so it's one doc per app. self.doc = Document(app=self) self.doc.model.connect() self.mainWindow = MainWindow(doc=self.doc) self.preferencesPanel = PreferencesPanel(self.mainWindow, app=self) self.aboutBox = AboutBox(self.mainWindow, self) self.initialFilePath = None if filepath and op.exists(filepath): self.initialFilePath = filepath elif self.prefs.recentDocuments: self.initialFilePath = self.prefs.recentDocuments[0] self.finishedLaunching.connect(self.applicationFinishedLaunching) QCoreApplication.instance().aboutToQuit.connect(self.applicationWillTerminate)
def __init__(self, vcs, parent=None): """ Constructor @param vcs reference to the vcs object @param parent parent widget (QWidget) """ super(HgAnnotateDialog, self).__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) self.vcs = vcs self.__hgClient = vcs.getClient() self.__annotateRe = re.compile( r"""(.+)\s+(\d+)\s+([0-9a-fA-F]+)\s+([0-9-]+)\s+(.+)""") self.annotateList.headerItem().setText( self.annotateList.columnCount(), "") font = Preferences.getEditorOtherFonts("MonospacedFont") self.annotateList.setFont(font) if self.__hgClient: self.process = None else: self.process = QProcess() self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) self.process.readyReadStandardError.connect(self.__readStderr) self.show() QCoreApplication.processEvents()
def __init__(self, parent, dict, persepolis_setting): super().__init__(persepolis_setting) self.persepolis_setting = persepolis_setting self.dict = dict self.parent = parent # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # connecting buttons self.open_pushButtun.clicked.connect(self.openFile) self.open_folder_pushButtun.clicked.connect(self.openFolder) self.ok_pushButton.clicked.connect(self.okButtonPressed) # labels # find gid gid = self.dict['gid'] # get file_path from data base self.add_link_dict = self.parent.persepolis_db.searchGidInAddLinkTable(gid) file_path = self.add_link_dict['download_path'] # save_as self.save_as_lineEdit.setText(file_path) self.save_as_lineEdit.setToolTip(file_path) # link link = str(self.dict['link']) self.link_lineEdit.setText(link) self.link_lineEdit.setToolTip(link) # file_name window_title = str(self.dict['file_name']) file_name = QCoreApplication.translate("after_download_src_ui_tr", "<b>File name</b>: ") + \ window_title self.setWindowTitle(window_title) self.file_name_label.setText(file_name) # size size = QCoreApplication.translate("after_download_src_ui_tr", "<b>Size</b>: ") + str(self.dict['size']) self.size_label.setText(size) # disable link_lineEdit and save_as_lineEdit self.link_lineEdit.setEnabled(False) self.save_as_lineEdit.setEnabled(False) # set window size and position size = self.persepolis_setting.value( 'AfterDownloadWindow/size', QSize(570, 290)) position = self.persepolis_setting.value( 'AfterDownloadWindow/position', QPoint(300, 300)) self.resize(size) self.move(position)
def exportShortcuts(fn): """ Module function to export the keyboard shortcuts for the defined QActions. @param fn filename of the export file (string) """ # let the plugin manager create on demand plugin objects pm = e5App().getObject("PluginManager") pm.initOnDemandPlugins() f = QFile(fn) if f.open(QIODevice.WriteOnly): from E5XML.ShortcutsWriter import ShortcutsWriter ShortcutsWriter(f).writeXML() f.close() else: E5MessageBox.critical( None, QCoreApplication.translate( "Shortcuts", "Export Keyboard Shortcuts"), QCoreApplication.translate( "Shortcuts", "<p>The keyboard shortcuts could not be written to file" " <b>{0}</b>.</p>") .format(fn))
def importShortcuts(fn): """ Module function to import the keyboard shortcuts for the defined E5Actions. @param fn filename of the import file (string) """ # let the plugin manager create on demand plugin objects pm = e5App().getObject("PluginManager") pm.initOnDemandPlugins() f = QFile(fn) if f.open(QIODevice.ReadOnly): from E5XML.ShortcutsReader import ShortcutsReader reader = ShortcutsReader(f) reader.readXML() f.close() if not reader.hasError(): shortcuts = reader.getShortcuts() setActions(shortcuts) saveShortcuts() syncPreferences() else: E5MessageBox.critical( None, QCoreApplication.translate( "Shortcuts", "Import Keyboard Shortcuts"), QCoreApplication.translate( "Shortcuts", "<p>The keyboard shortcuts could not be read from file" " <b>{0}</b>.</p>") .format(fn)) return
def addEntry(self, name, description, template, quiet=False): """ Public method to add a template entry to this group. @param name name of the entry (string) @param description description of the entry to add (string) @param template template text of the entry (string) @param quiet flag indicating quiet operation (boolean) """ if name in self.entries: if not quiet: E5MessageBox.critical( None, QCoreApplication.translate("TemplateGroup", "Add Template"), QCoreApplication.translate( "TemplateGroup", """<p>The group <b>{0}</b> already contains a""" """ template named <b>{1}</b>.</p>""") .format(self.name, name)) return self.entries[name] = TemplateEntry(self, name, description, template) if Preferences.getTemplates("AutoOpenGroups") and \ not self.isExpanded(): self.setExpanded(True)
def getImporterInfo(id): """ Module function to get information for the given HTML source id. @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), a prompt (string) and the default directory of the bookmarks file (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "html": return ( UI.PixmapCache.getPixmap("html.png"), "HTML Netscape Bookmarks", QCoreApplication.translate( "HtmlImporter", "HTML Netscape Bookmarks") + " (*.htm *.html)", QCoreApplication.translate( "HtmlImporter", """You can import bookmarks from any browser that supports""" """ HTML exporting. This file has usually the extension""" """ .htm or .html."""), QCoreApplication.translate( "HtmlImporter", """Please choose the file to begin importing bookmarks."""), "", ) else: raise ValueError("Unsupported browser ID given ({0}).".format(id))
def processEvents(self): # hack copied from QgsVectorLayerInterruption.... .mustStop # to allow responsive cancelation on linux i = 0 while i < 100 and QCoreApplication.hasPendingEvents(): QCoreApplication.processEvents() i += 1
def __init__(self, vcs, parent=None): """ Constructor @param vcs reference to the vcs object @param parent reference to the parent widget (QWidget) """ super(HgQueuesHeaderDialog, self).__init__(parent) self.setupUi(self) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) self.vcs = vcs self.__hgClient = vcs.getClient() if self.__hgClient: self.process = None else: self.process = QProcess() self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) self.process.readyReadStandardError.connect(self.__readStderr) self.show() QCoreApplication.processEvents()
def __init__(self, vcs, parent=None): """ Constructor @param vcs reference to the vcs object @param parent parent widget (QWidget) """ super(HgBookmarksListDialog, self).__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.refreshButton = self.buttonBox.addButton( self.tr("Refresh"), QDialogButtonBox.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the bookmarks display")) self.refreshButton.setEnabled(False) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) self.process = QProcess() self.vcs = vcs self.__bookmarksList = None self.__path = None self.__hgClient = vcs.getClient() self.bookmarksList.headerItem().setText( self.bookmarksList.columnCount(), "") self.bookmarksList.header().setSortIndicator(3, Qt.AscendingOrder) self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) self.process.readyReadStandardError.connect(self.__readStderr) self.show() QCoreApplication.processEvents()
def init(self, parent): layout = QHBoxLayout(parent) layout.setContentsMargins(0, 0, 0, 0) self.m_treeWidget = QtPropertyEditorView(parent) self.m_treeWidget.setEditorPrivate(self) self.m_treeWidget.setIconSize(QSize(18, 18)) layout.addWidget(self.m_treeWidget) parent.setFocusProxy(self.m_treeWidget) self.m_treeWidget.setColumnCount(2) labels = QList() labels.append(QCoreApplication.translate("QtTreePropertyBrowser", "Property")) labels.append(QCoreApplication.translate("QtTreePropertyBrowser", "Value")) self.m_treeWidget.setHeaderLabels(labels) self.m_treeWidget.setAlternatingRowColors(True) self.m_treeWidget.setEditTriggers(QAbstractItemView.EditKeyPressed) self.m_delegate = QtPropertyEditorDelegate(parent) self.m_delegate.setEditorPrivate(self) self.m_treeWidget.setItemDelegate(self.m_delegate) self.m_treeWidget.header().setSectionsMovable(False) self.m_treeWidget.header().setSectionResizeMode(QHeaderView.Stretch) self.m_expandIcon = drawIndicatorIcon(self.q_ptr.palette(), self.q_ptr.style()) self.m_treeWidget.collapsed.connect(self.slotCollapsed) self.m_treeWidget.expanded.connect(self.slotExpanded) self.m_treeWidget.currentItemChanged.connect(self.slotCurrentTreeItemChanged)
def on_quit(self): for dialog in list(self._active_dialogs.values()): dialog.close() self.save_state() self._trayicon.disable() self.hide() QCoreApplication.quit()
def __init__(self, vcs, extension, patchesList, parent=None): """ Constructor @param vcs reference to the vcs object @param extension reference to the extension module (Queues) @param patchesList list of patches (list of strings) @param parent reference to the parent widget (QWidget) """ super(HgQueuesDefineGuardsDialog, self).__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.vcs = vcs self.extension = extension self.__hgClient = vcs.getClient() self.__patches = patchesList[:] self.patchSelector.addItems([""] + self.__patches) self.plusButton.setIcon(UI.PixmapCache.getIcon("plus.png")) self.minusButton.setIcon(UI.PixmapCache.getIcon("minus.png")) self.__dirtyList = False self.__currentPatch = "" self.show() QCoreApplication.processEvents()
def _selectEntries(self, local=True, filter=None): """ Protected method to select entries based on their VCS status. @param local flag indicating local (i.e. non VCS controlled) file/directory entries should be selected (boolean) @param filter list of classes to check against """ if self.project.vcs is None: return if local: compareString = \ QCoreApplication.translate('ProjectBaseBrowser', "local") else: compareString = self.project.vcs.vcsName() # expand all directories in order to iterate over all entries self._expandAllDirs() QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() self.selectionModel().clear() QApplication.processEvents() # now iterate over all entries startIndex = None endIndex = None selectedEntries = 0 index = self.model().index(0, 0) while index.isValid(): itm = self.model().item(index) if self.wantedItem(itm, filter) and \ compareString == itm.data(1): if startIndex is not None and \ startIndex.parent() != index.parent(): self._setItemRangeSelected(startIndex, endIndex, True) startIndex = None selectedEntries += 1 if startIndex is None: startIndex = index endIndex = index else: if startIndex is not None: self._setItemRangeSelected(startIndex, endIndex, True) startIndex = None index = self.indexBelow(index) if startIndex is not None: self._setItemRangeSelected(startIndex, endIndex, True) QApplication.restoreOverrideCursor() QApplication.processEvents() if selectedEntries == 0: E5MessageBox.information( self, QCoreApplication.translate( 'ProjectBaseBrowser', "Select entries"), QCoreApplication.translate( 'ProjectBaseBrowser', """There were no matching entries found."""))
def main() -> None: signal.signal(signal.SIGINT, signal.SIG_DFL) app = QCoreApplication([]) testo = Testo() # This is causing the problem def a() -> None: # Using 'app' in a local function seems to be what requires # the manual 'del app' call, otherwise the garbage collector # needs to do the cleanup and probably comes to late, as # another QCoreApplication instance might have already been # created. print(app) # As long as the function isn't using 'app' everything seems to be # ok. def b() -> None: print("nothing") # If 'b' is used instead of 'a' the problem goes away testo.sig_test.connect(a) QTimer.singleShot(1000, app.quit) print("exec") app.exec() print("exec:done")
def readObjectTypes(self, fileName): self.mError = '' objectTypes = QVector() file = QFile(fileName) if (not file.open(QIODevice.ReadOnly | QIODevice.Text)): self.mError = QCoreApplication.translate( "ObjectTypes", "Could not open file.") return objectTypes reader = QXmlStreamReader(file) if (not reader.readNextStartElement() or reader.name() != "objecttypes"): self.mError = QCoreApplication.translate( "ObjectTypes", "File doesn't contain object types.") return objectTypes while (reader.readNextStartElement()): if (reader.name() == "objecttype"): atts = reader.attributes() name = QString(atts.value("name")) color = QColor(atts.value("color")) objectTypes.append(ObjectType(name, color)) reader.skipCurrentElement() if (reader.hasError()): self.mError = QCoreApplication.translate("ObjectTypes", "%s\n\nLine %d, column %d"%(reader.errorString(), reader.lineNumber(), reader.columnNumber())) return objectTypes return objectTypes
def start(): app = QCoreApplication([]) bus = QDBusConnection.sessionBus() server = MyServer() bus.registerObject('/mydbus', server) bus.registerService('com.home.dbus') app.exec()
def _initializeDefaults(self): self._fonts = {"system": QCoreApplication.instance().font()} palette = QCoreApplication.instance().palette() self._colors = {"system_window": palette.window(), "system_text": palette.text()} self._sizes = {"line": QSizeF(self._em_width, self._em_height)}
def __runcommand(self, args, inputChannels, outputChannels): """ Private method to run a command in the server (low level). @param args list of arguments for the command (list of string) @param inputChannels dictionary of input channels. The dictionary must have the keys 'I' and 'L' and each entry must be a function receiving the number of bytes to write. @param outputChannels dictionary of output channels. The dictionary must have the keys 'o' and 'e' and each entry must be a function receiving the data. @return result code of the command, -1 if the command server wasn't started or -10, if the command was canceled (integer) @exception RuntimeError raised to indicate an unexpected command channel """ if not self.__started: return -1 self.__server.write(QByteArray(b'runcommand\n')) self.__writeDataBlock('\0'.join(args)) while True: QCoreApplication.processEvents() if self.__cancel: return -10 if self.__server is None: return -1 if self.__server is None or self.__server.bytesAvailable() == 0: QThread.msleep(50) continue channel, data = self.__readChannel() # input channels if channel in inputChannels: input = inputChannels[channel](data) if channel == "L": # echo the input to the output if it was a prompt outputChannels["o"](input) self.__writeDataBlock(input) # output channels elif channel in outputChannels: outputChannels[channel](data) # result channel, command is finished elif channel == "r": return struct.unpack(HgClient.ReturnFormat, data)[0] # unexpected but required channel elif channel.isupper(): raise RuntimeError( "Unexpected but required channel '{0}'.".format(channel)) # optional channels or no channel at all else: pass
def setUpClass(cls): super(TestPersistWindowState, cls).setUpClass() # The QSettings default constructor uses the application's # organizationName and applicationName properties. QCoreApplication.setOrganizationName('NHM') QCoreApplication.setApplicationName('inselect')
class QgisAlgorithmProvider(QgsProcessingProvider): fieldMappingParameterName = QCoreApplication.translate( 'Processing', 'Fields Mapper') def __init__(self): super().__init__() self.algs = [] self.externalAlgs = [] def getAlgs(self): algs = [ AddTableField(), Aggregate(), Aspect(), BasicStatisticsForField(), CheckValidity(), ConcaveHull(), CreateAttributeIndex(), CreateConstantRaster(), Datasources2Vrt(), DefineProjection(), Delaunay(), DeleteColumn(), DeleteDuplicateGeometries(), DensifyGeometries(), DensifyGeometriesInterval(), EliminateSelection(), ExecuteSQL(), ExportGeometryInfo(), ExtendLines(), ExtentFromLayer(), ExtractSpecificVertices(), FieldsCalculator(), FieldsMapper(), FieldsPyculator(), FindProjection(), GeometryByExpression(), GeometryConvert(), Grid(), Heatmap(), Hillshade(), HubDistanceLines(), HubDistancePoints(), HypsometricCurves(), IdwInterpolation(), ImportIntoPostGIS(), ImportIntoSpatialite(), KeepNBiggestParts(), LinesToPolygons(), MinimumBoundingGeometry(), NearestNeighbourAnalysis(), OffsetLine(), Orthogonalize(), PointDistance(), PointsAlongGeometry(), PointsDisplacement(), PointsFromLines(), PointsFromPolygons(), PointsInPolygon(), PointsLayerFromTable(), PointsToPaths(), PoleOfInaccessibility(), Polygonize(), PolygonsToLines(), PostGISExecuteSQL(), RandomExtract(), RandomExtractWithinSubsets(), RandomPointsAlongLines(), RandomPointsExtent(), RandomPointsLayer(), RandomPointsPolygons(), RandomSelection(), RandomSelectionWithinSubsets(), RasterCalculator(), RasterizeAlgorithm(), RasterLayerStatistics(), RectanglesOvalsDiamondsFixed(), RectanglesOvalsDiamondsVariable(), RegularPoints(), Relief(), ReverseLineDirection(), Ruggedness(), SelectByAttribute(), SelectByExpression(), ServiceAreaFromLayer(), ServiceAreaFromPoint(), SetMValue(), SetRasterStyle(), SetVectorStyle(), SetZValue(), ShortestPathLayerToPoint(), ShortestPathPointToLayer(), ShortestPathPointToPoint(), SingleSidedBuffer(), Slope(), SnapGeometriesToLayer(), SpatialiteExecuteSQL(), SpatialIndex(), SpatialJoin(), SpatialJoinSummary(), StatisticsByCategories(), SumLines(), TextToFloat(), TinInterpolation(), TopoColor(), TruncateTable(), UniqueValues(), VariableDistanceBuffer(), VectorSplit(), VoronoiPolygons(), ZonalStatistics() ] if hasPlotly: from .BarPlot import BarPlot from .BoxPlot import BoxPlot from .MeanAndStdDevPlot import MeanAndStdDevPlot from .PolarPlot import PolarPlot from .RasterLayerHistogram import RasterLayerHistogram from .VectorLayerHistogram import VectorLayerHistogram from .VectorLayerScatterplot import VectorLayerScatterplot from .VectorLayerScatterplot3D import VectorLayerScatterplot3D algs.extend([ BarPlot(), BoxPlot(), MeanAndStdDevPlot(), PolarPlot(), RasterLayerHistogram(), VectorLayerHistogram(), VectorLayerScatterplot(), VectorLayerScatterplot3D() ]) # to store algs added by 3rd party plugins as scripts #folder = os.path.join(os.path.dirname(__file__), 'scripts') #scripts = ScriptUtils.loadFromFolder(folder) #for script in scripts: # script.allowEdit = False #algs.extend(scripts) return algs def id(self): return 'qgis' def name(self): return 'QGIS' def icon(self): return QgsApplication.getThemeIcon("/providerQgis.svg") def svgIconPath(self): return QgsApplication.iconPath("providerQgis.svg") def loadAlgorithms(self): self.algs = self.getAlgs() for a in self.algs: self.addAlgorithm(a) for a in self.externalAlgs: self.addAlgorithm(a) def load(self): success = super().load() if success: self.parameterTypeFieldsMapping = FieldsMapper.ParameterFieldsMappingType( ) QgsApplication.instance().processingRegistry().addParameterType( self.parameterTypeFieldsMapping) return success def unload(self): super().unload() QgsApplication.instance().processingRegistry().removeParameterType( self.parameterTypeFieldsMapping) def supportsNonFileBasedOutput(self): return True
def __init__(self,persepolis_setting): super().__init__() self.persepolis_setting = persepolis_setting # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) icons = ':/' + str(self.persepolis_setting.value('settings/icons')) + '/' self.setWindowIcon(QIcon.fromTheme('persepolis' ,QIcon(':/persepolis.svg'))) self.setWindowTitle(QCoreApplication.translate("after_download_ui_tr", "Persepolis Download Manager")) #complete_label window_verticalLayout = QVBoxLayout() window_verticalLayout.setContentsMargins(21, 21, 21, 21) self.complete_label = QLabel() window_verticalLayout.addWidget(self.complete_label) # file_name_label self.file_name_label = QLabel() window_verticalLayout.addWidget(self.file_name_label) # size_label self.size_label = QLabel() window_verticalLayout.addWidget(self.size_label) # link self.link_label = QLabel() window_verticalLayout.addWidget(self.link_label) self.link_lineEdit = QLineEdit() window_verticalLayout.addWidget(self.link_lineEdit) # save_as self.save_as_label = QLabel() window_verticalLayout.addWidget(self.save_as_label) self.save_as_lineEdit = QLineEdit() window_verticalLayout.addWidget(self.save_as_lineEdit) # open_pushButtun button_horizontalLayout = QHBoxLayout() button_horizontalLayout.setContentsMargins(10, 10, 10, 10) button_horizontalLayout.addStretch(1) self.open_pushButtun = QPushButton() self.open_pushButtun.setIcon(QIcon(icons + 'file')) button_horizontalLayout.addWidget(self.open_pushButtun) # open_folder_pushButtun self.open_folder_pushButtun = QPushButton() self.open_folder_pushButtun.setIcon(QIcon(icons + 'folder')) button_horizontalLayout.addWidget(self.open_folder_pushButtun) # ok_pushButton self.ok_pushButton = QPushButton() self.ok_pushButton.setIcon(QIcon(icons + 'ok')) button_horizontalLayout.addWidget(self.ok_pushButton) window_verticalLayout.addLayout(button_horizontalLayout) # dont_show_checkBox self.dont_show_checkBox = QCheckBox() window_verticalLayout.addWidget(self.dont_show_checkBox) window_verticalLayout.addStretch(1) self.setLayout(window_verticalLayout) # labels self.open_pushButtun.setText(QCoreApplication.translate("after_download_ui_tr", " Open File ")) self.open_folder_pushButtun.setText(QCoreApplication.translate("after_download_ui_tr", "Open Download Folder")) self.ok_pushButton.setText(QCoreApplication.translate("after_download_ui_tr", " OK ")) self.dont_show_checkBox.setText(QCoreApplication.translate("after_download_ui_tr", "Don't show this message again.")) self.complete_label.setText(QCoreApplication.translate("after_download_ui_tr", "<b>Download Completed!</b>")) self.save_as_label.setText(QCoreApplication.translate("after_download_ui_tr", "<b>Save as</b>: ")) self.link_label.setText(QCoreApplication.translate("after_download_ui_tr", "<b>Link</b>: " ))
currState = pyqtProperty(bool, fget=_get_currState, fset=_set_currState, notify=currStateChanged) # The slot exposed to a remote client. @pyqtSlot(bool) def server_slot(self, clientState): # The switch state echoed back by the client. print("Replica state is", clientState) def _timeout(self): # Note that we don't decorate this callable so that it doesn't get # exposed in a replica. self.currState = not self.currState print("Source state is", self.currState) if __name__ == '__main__': app = QCoreApplication(sys.argv) # Create the simple switch. srcSwitch = SimpleSwitch() # Create the host object node. srcNode = QRemoteObjectHost(QUrl('local:replica')) # Enable remoting. srcNode.enableRemoting(srcSwitch, 'SimpleSwitch') sys.exit(app.exec_())
def tr(self, string): return QCoreApplication.translate('ConcatFolder', string)
def __init__(self, text, help_text): QLabel.__init__(self, text) self.help_text = help_text self.app = QCoreApplication.instance() self.font = QFont()
def description(self): return QCoreApplication.translate( 'Processing', 'A mapping of field names to field type definitions and expressions. Used for the refactor fields algorithm.' )
def name(self): return QCoreApplication.translate('Processing', 'Fields Mapper')
def cancel_detection(): QCoreApplication.quit()
def tr(self, string): return QCoreApplication.translate( 'TopologicalDouglasSimplificationAlgorithm', string)
class IrcIdentity(object): """ Class implementing the IRC identity object. """ DefaultIdentityName = "0default" DefaultIdentityDisplay = QCoreApplication.translate( "IrcIdentity", "Default Identity") DefaultAwayMessage = QCoreApplication.translate("IrcIdentity", "Gone away for now.") DefaultQuitMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric6 IDE") DefaultPartMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric6 IDE") def __init__(self, name): """ Constructor @param name name of the identity (string) """ super(IrcIdentity, self).__init__() self.__name = name self.__realName = "" self.__nickNames = [] self.__serviceName = "" self.__password = "" self.__ident = Utilities.getUserName() self.__rememberPosOnAway = True self.__awayMessage = IrcIdentity.DefaultAwayMessage self.__quitMessage = IrcIdentity.DefaultQuitMessage self.__partMessage = IrcIdentity.DefaultPartMessage def save(self, settings): """ Public method to save the identity data. @param settings reference to the settings object (QSettings) """ # no need to save the name because that is the group key settings.setValue("Ident", self.__ident) settings.setValue("RealName", self.__realName) settings.setValue("NickNames", self.__nickNames) settings.setValue("ServiceName", self.__serviceName) settings.setValue("Password", self.__password) settings.setValue("QuitMessage", self.__quitMessage) settings.setValue("PartMessage", self.__partMessage) settings.setValue("RememberAwayPosition", self.__rememberPosOnAway) settings.setValue("AwayMessage", self.__awayMessage) def load(self, settings): """ Public method to load the identity data. @param settings reference to the settings object (QSettings) """ self.__ident = settings.value("Ident", Utilities.getUserName()) self.__realName = settings.value("RealName", "") self.__nickNames = Preferences.toList(settings.value("NickNames", [])) self.__serviceName = settings.value("ServiceName", "") self.__password = settings.value("Password", "") self.__quitMessage = settings.value("QuitMessage", IrcIdentity.DefaultQuitMessage) self.__partMessage = settings.value("PartMessage", IrcIdentity.DefaultPartMessage) self.__rememberPosOnAway = Preferences.toBool( settings.value("RememberAwayPosition", True)) self.__awayMessage = settings.value("AwayMessage", IrcIdentity.DefaultAwayMessage) def setName(self, name): """ Public method to set the identity name. @param name identity name (string) """ self.__name = name def getName(self): """ Public method to get the identity name. @return identity name (string) """ return self.__name def setIdent(self, name): """ Public method to set the real identity name. @param name real identity name (string) """ self.__ident = name def getIdent(self): """ Public method to get the real identity name. @return real identity name (string) """ return self.__ident def setRealName(self, name): """ Public method to set the real name of the identity. @param name real name (string) """ self.__realName = name def getRealName(self): """ Public method to get the real name. @return real name (string) """ return self.__realName def setNickNames(self, names): """ Public method to set the nick names of the identity. @param names nick names (list of string) """ self.__nickNames = names[:] def getNickNames(self): """ Public method to get the nick names. @return nick names (list of string) """ return self.__nickNames def setServiceName(self, name): """ Public method to set the service name of the identity used for identification. @param name service name (string) """ self.__serviceName = name def getServiceName(self): """ Public method to get the service name of the identity used for identification. @return service name (string) """ return self.__serviceName def setPassword(self, password): """ Public method to set a new password. @param password password to set (string) """ self.__password = pwConvert(password, encode=True) def getPassword(self): """ Public method to get the password. @return password (string) """ return pwConvert(self.__password, encode=False) def setQuitMessage(self, message): """ Public method to set the QUIT message. @param message QUIT message (string) """ if message: self.__quitMessage = message else: self.__quitMessage = IrcIdentity.DefaultQuitMessage def getQuitMessage(self): """ Public method to get the QUIT message. @return QUIT message (string) """ return self.__quitMessage def setPartMessage(self, message): """ Public method to set the PART message. @param message PART message (string) """ if message: self.__partMessage = message else: self.__partMessage = IrcIdentity.DefaultPartMessage def getPartMessage(self): """ Public method to get the PART message. @return PART message (string) """ return self.__partMessage def setRememberAwayPosition(self, remember): """ Public method to set to remember the chat position upon AWAY. @param remember flag indicating to remember the chat position (boolean) """ self.__rememberPosOnAway = remember def rememberAwayPosition(self): """ Public method to get a flag indicating to remember the chat position upon AWAY. @return flag indicating to remember the chat position (boolean) """ return self.__rememberPosOnAway def setAwayMessage(self, message): """ Public method to set the AWAY message. @param message AWAY message (string) """ if message: self.__awayMessage = message else: self.__awayMessage = IrcIdentity.DefaultAwayMessage def getAwayMessage(self): """ Public method to get the AWAY message. @return AWAY message (string) """ return self.__awayMessage @classmethod def createDefaultIdentity(cls): """ Class method to create the default identity. @return default identity (IrcIdentity) """ userName = Utilities.getUserName() realName = Utilities.getRealName() if not realName: realName = "eric IDE chat" identity = IrcIdentity(IrcIdentity.DefaultIdentityName) identity.setNickNames([userName, userName + "_", userName + "__"]) identity.setRealName(realName) identity.setIdent(userName) return identity
def tr(self, string): return QCoreApplication.translate('DigitransitGeocoderPluginAlgorithm', string)
class QgisAlgorithmProvider(QgsProcessingProvider): fieldMappingParameterName = QCoreApplication.translate( 'Processing', 'Fields Mapper') def __init__(self): super().__init__() self.algs = [] self.externalAlgs = [] QgsApplication.processingRegistry().addAlgorithmAlias( 'qgis:rectanglesovalsdiamondsfixed', 'native:rectanglesovalsdiamonds') def getAlgs(self): algs = [ Aggregate(), BarPlot(), BasicStatisticsForField(), BoxPlot(), CheckValidity(), Climb(), ConcaveHull(), DefineProjection(), Delaunay(), DeleteColumn(), EliminateSelection(), ExecuteSQL(), ExportGeometryInfo(), FieldsCalculator(), FieldsMapper(), FieldsPyculator(), FindProjection(), GeometryConvert(), Heatmap(), HubDistanceLines(), HubDistancePoints(), HypsometricCurves(), IdwInterpolation(), ImportIntoPostGIS(), ImportIntoSpatialite(), KeepNBiggestParts(), KNearestConcaveHull(), LinesToPolygons(), MeanAndStdDevPlot(), MinimumBoundingGeometry(), PointDistance(), PointsDisplacement(), PointsFromLines(), PointsToPaths(), PolarPlot(), PostGISExecuteAndLoadSQL(), RandomExtractWithinSubsets(), RandomPointsAlongLines(), RandomPointsLayer(), RandomPointsPolygons(), RandomSelection(), RandomSelectionWithinSubsets(), RasterCalculator(), RasterLayerHistogram(), RasterSampling(), RectanglesOvalsDiamondsVariable(), RegularPoints(), Relief(), SelectByAttribute(), SelectByExpression(), SetRasterStyle(), SetVectorStyle(), SpatialJoinSummary(), StatisticsByCategories(), TextToFloat(), TilesXYZAlgorithmDirectory(), TilesXYZAlgorithmMBTiles(), TinInterpolation(), TopoColor(), UniqueValues(), VariableDistanceBuffer(), VectorLayerHistogram(), VectorLayerScatterplot(), VectorLayerScatterplot3D(), VoronoiPolygons(), ] return algs def id(self): return 'qgis' def helpId(self): return 'qgis' def name(self): return 'QGIS' def icon(self): return QgsApplication.getThemeIcon("/providerQgis.svg") def svgIconPath(self): return QgsApplication.iconPath("providerQgis.svg") def loadAlgorithms(self): self.algs = self.getAlgs() for a in self.algs: self.addAlgorithm(a) for a in self.externalAlgs: self.addAlgorithm(a) def load(self): success = super().load() if success: self.parameterTypeFieldsMapping = FieldsMapper.ParameterFieldsMappingType( ) QgsApplication.instance().processingRegistry().addParameterType( self.parameterTypeFieldsMapping) return success def unload(self): super().unload() QgsApplication.instance().processingRegistry().removeParameterType( self.parameterTypeFieldsMapping) def supportsNonFileBasedOutput(self): return True
def iLangEnglish(): return QCoreApplication.translate('Galacteek', 'English')
def __init__(self, config: dict, screen_size: QSize, logger: logging.Logger, manage_process: Popen = None, settings_process: Popen = None): super(TrayIcon, self).__init__() self.i18n = generate_i18n(config, resource.get_path('locale/tray')) self.screen_size = screen_size self.manage_process = manage_process self.settings_process = settings_process self.logger = logger self.http_client = HttpClient(logger=logger) if config['ui']['tray']['default_icon']: self.icon_default = QIcon(config['ui']['tray']['default_icon']) else: self.icon_default = QIcon.fromTheme('bauh_tray_default') if self.icon_default.isNull(): self.icon_default = load_resource_icon('img/logo.svg', 24) if config['ui']['tray']['updates_icon']: self.icon_updates = QIcon(config['ui']['tray']['updates_icon']) else: self.icon_updates = QIcon.fromTheme('bauh_tray_updates') if self.icon_updates.isNull(): self.icon_updates = load_resource_icon('img/logo_update.svg', 24) self.setIcon(self.icon_default) self.menu = QMenu() self.action_manage = self.menu.addAction( self.i18n['tray.action.manage']) self.action_manage.triggered.connect(self.show_manage_window) self.action_settings = self.menu.addAction( self.i18n['tray.settings'].capitalize()) self.action_settings.triggered.connect(self.show_settings_window) self.action_about = self.menu.addAction(self.i18n['tray.action.about']) self.action_about.triggered.connect(self.show_about) self.action_exit = self.menu.addAction(self.i18n['tray.action.exit']) self.action_exit.triggered.connect(lambda: QCoreApplication.exit()) self.setContextMenu(self.menu) self.manage_window = None self.dialog_about = None self.settings_window = None self.check_lock = Lock() self.check_thread = UpdateCheck(check_interval=int( config['updates']['check_interval']), check_file=False, lock=self.check_lock, logger=logger) self.check_thread.signal.connect(self.notify_updates) self.check_thread.start() self.recheck_thread = UpdateCheck(check_interval=2, check_file=True, lock=self.check_lock, logger=logger) self.recheck_thread.signal.connect(self.notify_updates) self.recheck_thread.start() self.update_thread = AppUpdateCheck(http_client=self.http_client, logger=self.logger, i18n=self.i18n) self.update_thread.start() self.last_updates = set() self.update_notification = bool(config['system']['notifications']) self.lock_notify = Lock() self.activated.connect(self.handle_click) self.set_default_tooltip()
def iLangCastilianSpanish(): return QCoreApplication.translate('Galacteek', 'Spanish (Castilian)')
def Exit(self): self.capTimer.stop() self.CloseDevices() QCoreApplication.quit()
__copyright__ = '(C) 2013, Juergen E. Fischer' # This will get replaced with a git SHA1 when you do a git archive __revision__ = '46f867cef4f9e8fae530a0e6ae774ae52a1f0826' import sys import struct from PyQt5.QtCore import QCoreApplication, QSettings def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n] QCoreApplication.setOrganizationName("QGIS") QCoreApplication.setOrganizationDomain("qgis.org") QCoreApplication.setApplicationName("QGIS3") if len(sys.argv) == 1: print("Usage: ./scripts/mkuidefaults.py \"location_to_ini\"") sys.exit(1) s = QSettings(sys.argv[1], QSettings.IniFormat) ba = bytes(s.value("/UI/geometry")) print with open("src/app/ui_defaults.h", "w") as f: f.write("#ifndef UI_DEFAULTS_H\n#define UI_DEFAULTS_H\n" +
def iLanguageChanged(): return QCoreApplication.translate( 'Galacteek', "The application's language was changed")
def __init__(self, persepolis_setting): super().__init__() self.persepolis_setting = persepolis_setting icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) window_verticalLayout = QVBoxLayout() self.setLayout(window_verticalLayout) # queue_tabWidget self.queue_tabWidget = QTabWidget(self) window_verticalLayout.addWidget(self.queue_tabWidget) # links_tab self.links_tab = QWidget() links_tab_verticalLayout = QVBoxLayout(self.links_tab) # link table self.links_table = QTableWidget(self.links_tab) links_tab_verticalLayout.addWidget(self.links_table) self.links_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.links_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.links_table.verticalHeader().hide() self.links_table.setColumnCount(3) links_table_header_labels = [ 'File Name', 'Download Link', 'dictionary' ] self.links_table.setHorizontalHeaderLabels(links_table_header_labels) self.links_table.setColumnHidden(2, True) self.links_table.horizontalHeader().setSectionResizeMode(0) self.links_table.horizontalHeader().setStretchLastSection(True) # add_queue add_queue_horizontalLayout = QHBoxLayout() self.select_all_pushButton = QPushButton(self.links_tab) add_queue_horizontalLayout.addWidget(self.select_all_pushButton) self.deselect_all_pushButton = QPushButton(self.links_tab) add_queue_horizontalLayout.addWidget(self.deselect_all_pushButton) add_queue_horizontalLayout.addStretch(1) self.add_queue_label = QLabel(self.links_tab) add_queue_horizontalLayout.addWidget(self.add_queue_label) self.add_queue_comboBox = QComboBox(self.links_tab) add_queue_horizontalLayout.addWidget(self.add_queue_comboBox) links_tab_verticalLayout.addLayout(add_queue_horizontalLayout) self.queue_tabWidget.addTab(self.links_tab, "") # options_tab self.options_tab = QWidget() options_tab_verticalLayout = QVBoxLayout(self.options_tab) # proxy proxy_verticalLayout = QVBoxLayout() self.proxy_checkBox = QCheckBox(self.options_tab) proxy_verticalLayout.addWidget(self.proxy_checkBox) self.proxy_frame = QFrame(self.options_tab) self.proxy_frame.setFrameShape(QFrame.StyledPanel) self.proxy_frame.setFrameShadow(QFrame.Raised) proxy_gridLayout = QGridLayout(self.proxy_frame) self.ip_lineEdit = QLineEdit(self.proxy_frame) self.ip_lineEdit.setInputMethodHints(QtCore.Qt.ImhNone) proxy_gridLayout.addWidget(self.ip_lineEdit, 0, 1, 1, 1) self.proxy_pass_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.proxy_pass_label, 2, 2, 1, 1) self.proxy_pass_lineEdit = QLineEdit(self.proxy_frame) self.proxy_pass_lineEdit.setEchoMode(QLineEdit.Password) proxy_gridLayout.addWidget(self.proxy_pass_lineEdit, 2, 3, 1, 1) self.ip_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.ip_label, 0, 0, 1, 1) self.proxy_user_lineEdit = QLineEdit(self.proxy_frame) proxy_gridLayout.addWidget(self.proxy_user_lineEdit, 0, 3, 1, 1) self.proxy_user_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.proxy_user_label, 0, 2, 1, 1) self.port_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.port_label, 2, 0, 1, 1) self.port_spinBox = QSpinBox(self.proxy_frame) self.port_spinBox.setMaximum(9999) self.port_spinBox.setSingleStep(1) proxy_gridLayout.addWidget(self.port_spinBox, 2, 1, 1, 1) proxy_verticalLayout.addWidget(self.proxy_frame) options_tab_verticalLayout.addLayout(proxy_verticalLayout) # download UserName & Password download_horizontalLayout = QHBoxLayout() download_horizontalLayout.setContentsMargins(-1, 10, -1, -1) download_verticalLayout = QVBoxLayout() self.download_checkBox = QCheckBox(self.options_tab) download_verticalLayout.addWidget(self.download_checkBox) self.download_frame = QFrame(self.options_tab) self.download_frame.setFrameShape(QFrame.StyledPanel) self.download_frame.setFrameShadow(QFrame.Raised) download_gridLayout = QGridLayout(self.download_frame) self.download_user_lineEdit = QLineEdit(self.download_frame) download_gridLayout.addWidget(self.download_user_lineEdit, 0, 1, 1, 1) self.download_user_label = QLabel(self.download_frame) download_gridLayout.addWidget(self.download_user_label, 0, 0, 1, 1) self.download_pass_label = QLabel(self.download_frame) download_gridLayout.addWidget(self.download_pass_label, 1, 0, 1, 1) self.download_pass_lineEdit = QLineEdit(self.download_frame) self.download_pass_lineEdit.setEchoMode(QLineEdit.Password) download_gridLayout.addWidget(self.download_pass_lineEdit, 1, 1, 1, 1) download_verticalLayout.addWidget(self.download_frame) download_horizontalLayout.addLayout(download_verticalLayout) # select folder self.folder_frame = QFrame(self.options_tab) self.folder_frame.setFrameShape(QFrame.StyledPanel) self.folder_frame.setFrameShadow(QFrame.Raised) folder_gridLayout = QGridLayout(self.folder_frame) self.download_folder_lineEdit = QLineEdit(self.folder_frame) folder_gridLayout.addWidget(self.download_folder_lineEdit, 2, 0, 1, 1) self.folder_pushButton = QPushButton(self.folder_frame) folder_gridLayout.addWidget(self.folder_pushButton, 3, 0, 1, 1) self.folder_pushButton.setIcon(QIcon(icons + 'folder')) self.folder_label = QLabel(self.folder_frame) self.folder_label.setAlignment(QtCore.Qt.AlignCenter) folder_gridLayout.addWidget(self.folder_label, 1, 0, 1, 1) download_horizontalLayout.addWidget(self.folder_frame) options_tab_verticalLayout.addLayout(download_horizontalLayout) self.queue_tabWidget.addTab(self.options_tab, '') # limit Speed limit_verticalLayout = QVBoxLayout() self.limit_checkBox = QCheckBox(self.options_tab) limit_verticalLayout.addWidget(self.limit_checkBox) self.limit_frame = QFrame(self.options_tab) self.limit_frame.setFrameShape(QFrame.StyledPanel) self.limit_frame.setFrameShadow(QFrame.Raised) limit_horizontalLayout = QHBoxLayout(self.limit_frame) self.limit_spinBox = QSpinBox(self.limit_frame) self.limit_spinBox.setMinimum(1) self.limit_spinBox.setMaximum(1023) limit_horizontalLayout.addWidget(self.limit_spinBox) self.limit_comboBox = QComboBox(self.limit_frame) self.limit_comboBox.addItem("KB/S") self.limit_comboBox.addItem("MB/S") limit_horizontalLayout.addWidget(self.limit_comboBox) limit_verticalLayout.addWidget(self.limit_frame) limit_connections_horizontalLayout = QHBoxLayout() limit_connections_horizontalLayout.addLayout(limit_verticalLayout) # number of connections connections_horizontalLayout = QHBoxLayout() connections_horizontalLayout.setContentsMargins(-1, 10, -1, -1) self.connections_frame = QFrame(self.options_tab) self.connections_frame.setFrameShape(QFrame.StyledPanel) self.connections_frame.setFrameShadow(QFrame.Raised) horizontalLayout_3 = QHBoxLayout(self.connections_frame) self.connections_label = QLabel(self.connections_frame) horizontalLayout_3.addWidget(self.connections_label) self.connections_spinBox = QSpinBox(self.connections_frame) self.connections_spinBox.setMinimum(1) self.connections_spinBox.setMaximum(16) self.connections_spinBox.setProperty("value", 16) horizontalLayout_3.addWidget(self.connections_spinBox) connections_horizontalLayout.addWidget(self.connections_frame) limit_connections_horizontalLayout.addLayout( connections_horizontalLayout) options_tab_verticalLayout.addLayout( limit_connections_horizontalLayout) # buttons buttons_horizontalLayout = QHBoxLayout() buttons_horizontalLayout.addStretch(1) # ok_pushButton self.ok_pushButton = QPushButton(self) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) buttons_horizontalLayout.addWidget(self.ok_pushButton) # cancel_pushButton self.cancel_pushButton = QPushButton(self) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) buttons_horizontalLayout.addWidget(self.cancel_pushButton) window_verticalLayout.addLayout(buttons_horizontalLayout) # labels self.setWindowTitle( QCoreApplication.translate("text_ui_tr", "Persepolis Download Manager")) self.queue_tabWidget.setTabText( self.queue_tabWidget.indexOf(self.links_tab), QCoreApplication.translate("text_ui_tr", 'Links')) self.queue_tabWidget.setTabText( self.queue_tabWidget.indexOf(self.options_tab), QCoreApplication.translate("text_ui_tr", 'Download options')) self.select_all_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'Select All')) self.deselect_all_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'Deselect All')) self.add_queue_label.setText( QCoreApplication.translate("text_ui_tr", 'Add to queue : ')) self.proxy_checkBox.setText( QCoreApplication.translate("text_ui_tr", 'Proxy')) self.proxy_pass_label.setText( QCoreApplication.translate("text_ui_tr", "Proxy PassWord : "******"text_ui_tr", "IP :")) self.proxy_user_label.setText( QCoreApplication.translate("text_ui_tr", "Proxy UserName : "******"text_ui_tr", "Port:")) self.download_checkBox.setText( QCoreApplication.translate("text_ui_tr", "Download UserName and PassWord")) self.download_user_label.setText( QCoreApplication.translate("text_ui_tr", "Download UserName : "******"text_ui_tr", "Download PassWord : "******"text_ui_tr", "Change Download Folder")) self.folder_label.setText( QCoreApplication.translate("text_ui_tr", "Download Folder : ")) self.limit_checkBox.setText( QCoreApplication.translate("text_ui_tr", "Limit Speed")) self.connections_label.setText( QCoreApplication.translate("text_ui_tr", "Number Of Connections :")) self.ok_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'OK')) self.cancel_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'Cancel'))
def iLangFrench(): return QCoreApplication.translate('Galacteek', 'French')
def __init__(self, persepolis_setting): super().__init__() self.persepolis_setting = persepolis_setting # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' self.setMinimumSize(QtCore.QSize(363, 300)) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setLayoutDirection(QtCore.Qt.LeftToRight) self.gridLayout = QtWidgets.QGridLayout(self) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.verticalLayout = QtWidgets.QVBoxLayout() self.title_label = QtWidgets.QLabel(self) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.title_label.setFont(font) self.title_label.setAlignment(QtCore.Qt.AlignCenter) self.verticalLayout.addWidget(self.title_label) self.version_label = QtWidgets.QLabel(self) self.version_label.setAlignment(QtCore.Qt.AlignCenter) self.verticalLayout.addWidget(self.version_label) self.name_label = QtWidgets.QLabel(self) self.name_label.setAlignment(QtCore.Qt.AlignCenter) self.verticalLayout.addWidget(self.name_label) self.site2_label = QtWidgets.QLabel(self) self.site2_label.setTextFormat(QtCore.Qt.RichText) self.site2_label.setAlignment(QtCore.Qt.AlignCenter) self.site2_label.setOpenExternalLinks(True) self.site2_label.setTextInteractionFlags( QtCore.Qt.TextBrowserInteraction) self.verticalLayout.addWidget(self.site2_label) self.telegram_label = QtWidgets.QLabel(self) self.telegram_label.setTextFormat(QtCore.Qt.RichText) self.telegram_label.setAlignment(QtCore.Qt.AlignCenter) self.telegram_label.setOpenExternalLinks(True) self.telegram_label.setTextInteractionFlags( QtCore.Qt.TextBrowserInteraction) self.verticalLayout.addWidget(self.telegram_label) self.twitter_label = QtWidgets.QLabel(self) self.twitter_label.setTextFormat(QtCore.Qt.RichText) self.twitter_label.setAlignment(QtCore.Qt.AlignCenter) self.twitter_label.setOpenExternalLinks(True) self.twitter_label.setTextInteractionFlags( QtCore.Qt.TextBrowserInteraction) self.verticalLayout.addWidget(self.twitter_label) self.horizontalLayout_2.addLayout(self.verticalLayout) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtWidgets.QHBoxLayout() spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.pushButton = QtWidgets.QPushButton(self) self.pushButton.setIcon(QIcon(icons + 'ok')) self.pushButton.clicked.connect(self.close) self.horizontalLayout.addWidget(self.pushButton) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.verticalLayout_2.addLayout(self.horizontalLayout) self.gridLayout.addLayout(self.verticalLayout_2, 0, 0, 1, 1) QtCore.QMetaObject.connectSlotsByName(self) self.setWindowTitle( QCoreApplication.translate("about_ui_tr", "About Persepolis")) self.title_label.setText( QCoreApplication.translate("about_ui_tr", "Persepolis Download Manager")) self.version_label.setText( QCoreApplication.translate("about_ui_tr", "Version 3.0.1")) self.name_label.setText( QCoreApplication.translate( "about_ui_tr", "\nAliReza AmirSamimi\nMohammadreza Abdollahzadeh\nSadegh Alirezaie\nMostafa Asadi\nMohammadAmin Vahedinia\nJafar Akhondali" )) self.site2_label.setText( QCoreApplication.translate( "about_ui_tr", "<a href=https://persepolisdm.github.io>https://persepolisdm.github.io</a>" )) self.telegram_label.setText( QCoreApplication.translate( "about_ui_tr", "<a href=https://telegram.me/persepolisdm>https://telegram.me/persepolisdm</a>" )) self.twitter_label.setText( QCoreApplication.translate( "about_ui_tr", "<a href=https://twitter.com/persepolisdm>https://twitter.com/persepolisdm</a>" )) self.pushButton.setText(QCoreApplication.translate( "about_ui_tr", "Ok"))
def tr(self, string): return QCoreApplication.translate('IdentifyDuplicatedFeaturesAlgorithm', string)
def __del__(self): if QCoreApplication.instance(): QCoreApplication.instance().removeEventFilter(self)
def ExitApp(self): self.Timer.Stop() self.camera.release() QCoreApplication.quit()
def __tr(self, str): return QCoreApplication.translate("DarkestDungeon", str)
def tr(self, string): return QCoreApplication.translate('Processing', string)
def _find_file(path): tagger = QCoreApplication.instance() return tagger.files.get(path, None)
def setupUi(self, AddUser): AddUser.setObjectName("AddUser") AddUser.resize(355, 497) AddUser.move(490, 100) self.centralWidget = QtWidgets.QWidget(AddUser) self.centralWidget.setObjectName("centralWidget") self.textEdit_3 = QtWidgets.QTextEdit(self.centralWidget) self.textEdit_3.setGeometry(QtCore.QRect(120, 120, 201, 81)) self.textEdit_3.setObjectName("textEdit_3") self.lineEdit = QtWidgets.QLineEdit(self.centralWidget) self.lineEdit.setGeometry(QtCore.QRect(120, 81, 201, 31)) self.lineEdit.setObjectName("lineEdit") self.lineEdit_2 = QtWidgets.QLineEdit(self.centralWidget) self.lineEdit_2.setGeometry(QtCore.QRect(120, 41, 201, 31)) self.lineEdit_2.setObjectName("lineEdit_2") self.label_4 = QtWidgets.QLabel(self.centralWidget) self.label_4.setGeometry(QtCore.QRect(50, 50, 59, 14)) self.label_4.setObjectName("label_4") self.label_5 = QtWidgets.QLabel(self.centralWidget) self.label_5.setGeometry(QtCore.QRect(50, 90, 61, 16)) self.label_5.setObjectName("label_5") self.groupBox = QtWidgets.QGroupBox(self.centralWidget) self.groupBox.setGeometry(QtCore.QRect(30, 20, 301, 451)) self.groupBox.setObjectName("groupBox") self.textEdit_2 = QtWidgets.QTextEdit(self.groupBox) self.textEdit_2.setGeometry(QtCore.QRect(90, 310, 201, 61)) self.textEdit_2.setObjectName("textEdit_2") self.label_3 = QtWidgets.QLabel(self.groupBox) self.label_3.setGeometry(QtCore.QRect(20, 330, 59, 14)) self.label_3.setObjectName("label_3") self.textEdit = QtWidgets.QTextEdit(self.groupBox) self.textEdit.setGeometry(QtCore.QRect(90, 200, 201, 91)) self.textEdit.setObjectName("textEdit") self.label_2 = QtWidgets.QLabel(self.groupBox) self.label_2.setGeometry(QtCore.QRect(10, 230, 71, 16)) self.label_2.setObjectName("label_2") self.label = QtWidgets.QLabel(self.groupBox) self.label.setGeometry(QtCore.QRect(20, 130, 21, 16)) self.label.setObjectName("label") self.pushButton = QtWidgets.QPushButton(self.groupBox) self.pushButton.setGeometry(QtCore.QRect(210, 420, 80, 22)) self.pushButton.setObjectName("pushButton") self.pushButton.clicked.connect(self.UpdateButton) self.pushButton.clicked.connect(QCoreApplication.instance().quit) self.pushButton.clicked.connect(lambda: self.run('update_success.py')) self.pushButton_2 = QtWidgets.QPushButton(self.groupBox) self.pushButton_2.setGeometry(QtCore.QRect(90, 420, 80, 22)) self.pushButton_2.clicked.connect(QCoreApplication.instance().quit) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(self.groupBox) self.pushButton_3.setGeometry(QtCore.QRect(140, 380, 111, 22)) self.pushButton_3.clicked.connect(lambda: self.run('image.py')) self.pushButton_3.setObjectName("pushButton_3") self.groupBox.raise_() self.textEdit_3.raise_() self.lineEdit.raise_() self.lineEdit_2.raise_() self.label_4.raise_() self.label_5.raise_() AddUser.setCentralWidget(self.centralWidget) self.fetch_info() self.retranslateUi(AddUser) QtCore.QMetaObject.connectSlotsByName(AddUser)
def _find_cluster(cluster_hash): tagger = QCoreApplication.instance() for cluster in tagger.clusters: if hash(cluster) == cluster_hash: return cluster return None
def is_enabled(): tagger = QCoreApplication.instance() return tagger.browser_integration.is_running