Exemplo n.º 1
0
 def __init__(self, app):
     QDialog.__init__(self)
     self.app = app
     self.app_path = os.getenv("APPDATA") + "\\" + qApp.applicationName()
     self.registrySettings = QSettings("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", QSettings.NativeFormat)
     self.table_path = self.app_path + "\\tables"
     self.engine = Engine()
     self.minimize_action = QAction("Minimize", self)
     self.maximize_action = QAction("Maximize", self)
     self.settings_action = QAction("Settings", self)
     self.about_action = QAction("About", self)
     self.quit_action = QAction("Quit", self)
     self.tray_icon_menu = QMenu(self)
     self.tray_icon = QSystemTrayIcon(self)
     self.setupUi(self)
     self.icon = QIcon(QPixmap(":icon/off_logo"))
     self.construct_tray_icon()
     self.signal_connectors()
     self.database = DatabaseManager()
     self.shortcut_key = self.database.get_shortcut_key()
     self.populate_modifier_cbox()
     if self.database.get_current_state() == "True":
         self.engine.conv_state = False
     else:
         self.engine.conv_state = True
     self.icon_activated(QSystemTrayIcon.Trigger)
     self.file_path_tview.setEnabled(False)
     self.check_app_path()
     self.update_table(True)
     self.init_combobox()
     if self.registrySettings.contains(qApp.applicationName()):
         self.start_windows_check.setChecked(True)
     else:
         self.start_windows_check.setChecked(False)
Exemplo n.º 2
0
    def __init__(self, icon, parent=None):
        QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)

        settings = QSettings()

        menu = QtWidgets.QMenu(parent)
        exitAction = menu.addAction("Exit")
        selDirAction = menu.addAction("Select watched dir")
        renameAllAction = menu.addAction("Rename all Files")
        self.setContextMenu(menu)

        self.activated.connect(self.callRenameDialog)
        exitAction.triggered.connect(self.stopbuttonpressed)
        selDirAction.triggered.connect(self.showDirSelector)
        renameAllAction.triggered.connect(self.renameAllFiles)

        self.reactiondialog = RenameDialog()
        defaultWatchedDir = os.path.normcase(os.getcwd(
        ))  # Beim ersten Start: Überwachtes Verzeichnis = Arbeitsverzeichnis
        self.watchedDir = settings.value(
            "WatchedDirectory", defaultWatchedDir
        )  # Zuletzt verwendetes Verzeichnis wiederverwenden
        self.reactiondialog.watchedDir = self.watchedDir
        print("Watched directories: ", self.watchedDir)

        self.observer = Observer()
        self.handler = WatchdogHandler()
        self.observer.schedule(self.handler, self.watchedDir, False)
        self.observer.start()

        self.reIndexDirectory()

        self.handler.newfile.connect(self.filesChanged)
Exemplo n.º 3
0
    def showDirSelector(self):
        print("selektor gewählt")
        fname = QtWidgets.QFileDialog.getExistingDirectory(
            None, "Überwachtes Verzeichnis wählen",
            self.watchedDir)  # Zeigt den Dialog
        fname = os.path.normcase(fname)
        if (
                fname != self.watchedDir and fname
        ):  # Prüfung ob Verzeichnis gewählt wurde und ob es sich vom vorherigen unterscheidet
            self.observer.unschedule_all()  # Watchdog anhalten
            print("Watchdog gestoppt")
            self.observer.schedule(self.handler, fname,
                                   False)  # Watchdog neu starten
            self.watchedDir = fname
            self.reactiondialog.watchedDir = self.watchedDir

            settings = QSettings()
            settings.setValue(
                "WatchedDirectory",
                self.watchedDir)  # neuen Verzeichnispfad speichern

            print("Überwache jetzt:", fname)
            self.reIndexDirectory(
            )  # Verzeichnis neu einlesen und Dateien indizieren
        else:
            print("Verzeichnis nicht geändert")
Exemplo n.º 4
0
    def __init__(self, fileName=None):
        self._settings = None  # QSharedPointer<QSettings>

        if fileName is not None:
            self._settings = QSettings(fileName, QSettings.IniFormat)
            self._settings.setIniCodec('UTF-8')
            self._settings.beginGroup('Desktop Entry')
Exemplo n.º 5
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setupUi(self)

        settings = QSettings()
        if settings.value(
                "Geometry"):  # Sind Vorgaben in der Registry vorhanden?
            self.restoreGeometry(
                settings.value("Geometry")
            )  # Dann Größe und Position des Fensters wiederherstellen

#         self.watchedDir = os.getcwd()

        self.renameButton.clicked.connect(self.renameSelectedFile)

        self.dateEdit.setText(date.today().isoformat())
        self.dateEdit.textChanged.connect(self.updatePreview)

        self.descriptionSuggestions.hide()

        self.descriptionEdit.textEdited.connect(self.updatePreview)
        self.descriptionEdit.textEdited.connect(self.runCompletion)

        self.sectionBox.currentIndexChanged.connect(self.updatePreview)

        self.lastModifiedComponent = "Y"
Exemplo n.º 6
0
 def __init__(self, img_size):
     super().__init__()
     self.settings = QSettings("Theo Styles",
                               "Convolutional Neural Network")
     self.img_shape = (img_size, img_size)
     self.training_labels = np.array([])
     self.training_images = np.array([])
     self.labels = []
Exemplo n.º 7
0
 def __init__(self, game_dic={}, settings=QSettings()):
     self.context = zmq.Context()
     self.game_dic = game_dic
     # self.ip = "192.168.1.98"
     if settings.contains("ip_client"):
         self.ip = settings.value("ip_client")
     else:
         self.ip = "localhost"
     self.port = 5555
     self.connect_socket()
Exemplo n.º 8
0
 def __init__(self, open_file_slot, settings_key, menu):
     self.open_file_slot = open_file_slot
     self.settings_key = settings_key
     self.menu = menu
     settings = QSettings()
     file_list = settings.value(settings_key)
     if file_list is not None:
         for file_name in file_list:
             self.append(RecentFile(file_name, self.open_file_slot))
     self.update()
Exemplo n.º 9
0
 def settingsValue(key, default, t=None):
     if t is None:
         t = type(default)
     syslog.syslog(
         syslog.LOG_DEBUG,
         "DEBUG  settingsValue %s, default: %s, type: %s" %
         (key, str(default), t))
     s = QSettings()
     var = s.value(key, default, t)
     if not s.contains(key): s.setValue(key, var)
     syslog.syslog(
         syslog.LOG_DEBUG, "DEBUG  settingsValue %s, value: %s, type: %s" %
         (key, var, str(t)))
     return var
Exemplo n.º 10
0
 def add_file(self, file_name):
     item = RecentFile(file_name, self.open_file_slot)
     if (len(self) > 0) and (self[0] == item):
         return  # No action; it's already there
     if item in self:
         self.remove(item)  # it might be later in the list
     self.insert(0, item)  # make it the first in this list
     if len(self) > 10:
         self[:] = self[:10]
     # List changed, so save it to the registry
     settings = QSettings()
     file_list = [x.file_name for x in self]
     settings.setValue(self.settings_key, file_list)
     self.update()
Exemplo n.º 11
0
 def __init__(self, context, settings = QSettings()):
     # self.context = zmq.Context()
     QtCore.QObject.__init__(self)
     self.subport = 5556
     # self.ip = "192.168.1.98"
     if settings.contains("ip_client"):
         self.ip = settings.value("ip_client")
     else:
         self.ip = "localhost"
     self.sub_socket = context.socket(zmq.SUB)
     self.sub_socket.connect("tcp://" + self.ip + ':' + str(self.subport))
     topicfilter = "message"
     self.sub_socket.setsockopt_string(zmq.SUBSCRIBE, topicfilter)
     self.running = True
Exemplo n.º 12
0
    def __init__(self):
        self.settings = QSettings("yayachiken", "PyMorsetrainer")
        if not self.settings.allKeys():
            print("Initializing application settings...")
            self.settings.setValue("currentLesson", "1")
            self.settings.setValue("wpm", "20")
            self.settings.setValue("effectiveWpm", "15")
            self.settings.setValue("frequency", "800")
            self.settings.setValue("duration", "1")

        self.requireNewExercise = False
        self.mp = None
        self.lessonButtons = []
        self.debug = False

        super().__init__()
        self.initUI()
        self.generateExercise()
Exemplo n.º 13
0
    def __init__(self, imgDir, app, start_args):
        super().__init__()
        self.app = app
        # Register the signal handlers
        signal.signal(signal.SIGTERM, service_shutdown)
        signal.signal(signal.SIGINT, service_shutdown)

        # Get version and title
        self.version = getSPMTVersion()
        self.title = 'SPMT - Secure PIVX Masternode Tool - v.%s-%s' % (
            self.version['number'], self.version['tag'])

        # Create the userdir if it doesn't exist
        if not os.path.exists(user_dir):
            os.makedirs(user_dir)

        # Open database
        self.db = Database(self)
        self.db.open()

        # Clean v4 migration (read data from old files and delete them)
        clean_v4_migration(self)

        # Check for startup args (clear data)
        if start_args.clearAppData:
            settings = QSettings('PIVX', 'SecurePivxMasternodeTool')
            settings.clear()
        if start_args.clearRpcData:
            self.db.clearTable('CUSTOM_RPC_SERVERS')
        if start_args.clearMnData:
            self.db.clearTable('MASTERNODES')

        # Clear Rewards and Governance DB (in case of forced shutdown)
        self.db.clearTable('REWARDS')
        self.db.clearTable('PROPOSALS')
        self.db.clearTable('MY_VOTES')

        # Read Masternode List
        masternode_list = self.db.getMasternodeList()
        # Read cached app data
        self.cache = readCacheSettings()
        # Initialize user interface
        self.initUI(masternode_list, imgDir)
Exemplo n.º 14
0
 def __init__(self,
              open_file_slot,
              settings_key,
              menu,
              app_name,
              org_name='Brunsgen International'):
     super().__init__()
     self.org_name = org_name
     self.app_name = app_name
     self.open_file_slot = open_file_slot
     self.settings_key = settings_key
     self.menu = menu
     settings = QSettings(self.org_name, self.app_name)
     file_list = settings.value(settings_key)
     if file_list is not None:
         for file_name in file_list:
             if len(file_name) < 1:
                 continue
             self.append(RecentFile(file_name, self.open_file_slot))
     self.update()
Exemplo n.º 15
0
    def __init__(self, parent):
        """
        Constructor of the PreferencesDialog.
        :param parent: A QWidget type (most likely the MainWindow) which is the parent widget of the dialog. 
        """
        super().__init__(parent)
        self.ui = Ui_PreferencesDialog()
        self.ui.setupUi(self)
        self._set_validators()

        self.settings = QSettings()

        # connect signals and slots
        self.ui.defaultValuesButton.clicked.connect(self._use_default_values)
        self.ui.buttonBox.accepted.connect(self._save_inputs)
        self.ui.outputFolderBrowseButton.clicked.connect(
            self._browse_output_folder)
        self.ui.vggBrowseButton.clicked.connect(self._browse_vgg)

        # disable "Use deepflow" checkbox under Microsoft Windows.
        self.ui.deepFlowCheckBox.setDisabled(get_os_type() == OS.WIN)
Exemplo n.º 16
0
    def _readDir(self, dir_, parent):
        '''
        @param: dir_ QDir
        @param: parent BookmarkItem
        '''
        for file_ in dir_.entryInfoList(QDir.Dirs | QDir.Files
                                        | QDir.NoDotAndDotDot):
            # file_ QFileInfo
            if file_.isDir():
                folder = BookmarkItem(BookmarkItem.Folder, parent)
                folder.setTitle(file_.baseName())

                folderDir = QDir(dir_)
                folderDir.cd(file_.baseName())
                self._readDir(folderDir, folder)
            elif file_.isFile():
                urlFile = QSettings(file_.absoluteFilePath(),
                                    QSettings.IniFormat)
                url = urlFile.value('InternetShortcut/URL', type=QUrl)

                item = BookmarkItem(BookmarkItem.Url, parent)
                item.setTitle(file_.baseName())
                item.setUrl(url)
Exemplo n.º 17
0
 def __init__(self):
     super(DataJar, self).__init__()
     self.settings = QSettings(assets.fs.dataPath() + '/data.ini',
                               QSettings.IniFormat)
     self.load()
Exemplo n.º 18
0
 def createSettings(cls, fileName):
     cls.s_settings = QSettings(fileName, QSettings.IniFormat)
Exemplo n.º 19
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from PyQt5.Qt import QSettings
__author__ = 'xiwei'

HOME = os.getcwd()
RESOURCE = os.path.join(HOME, 'resource')
ICON = os.path.join(RESOURCE, 'images', 'icon.png')
UI = os.path.join(RESOURCE, 'ui', 'main.ui')
UI_LOGIN = os.path.join(RESOURCE, 'ui', 'login.ui')
STYLE = os.path.join(RESOURCE, 'ui', 'style.css')

CLIENT_ID = QSettings().value('client_id')
Exemplo n.º 20
0
 def load_setting(self, name):
     settings = QSettings(self._settings_file, QSettings.NativeFormat)
     value = settings.value(name, "")
     self._logger.info("Load setting %s -> %s", name, str(value))
     return value
Exemplo n.º 21
0
 def save_setting(self, name, value):
     self._logger.info("Save setting %s -> %s", name, str(value))
     settings = QSettings(self._settings_file, QSettings.NativeFormat)
     settings.setValue(name, value)
Exemplo n.º 22
0
    def __init__(self, argv):  # noqa 901
        super(MainApplication, self).__init__(argv)
        self._isPrivate = False
        self._isPortable = True
        self._isClosing = False
        self._isStartingAfterCrash = False

        self._history = None  # History
        self._bookmarks = None  # Bookmarks
        self._autoFill = None  # AutoFill
        self._cookieJar = None  # CookieJar
        self._plugins = None  # PluginProxy
        self._browsingLibrary = None  # BrowsingLibrary

        self._networkManager = None
        self._restoreManager = None
        self._sessionManager = None
        self._downloadManager = None
        self._userAgentManager = None
        self._searchEnginesManager = None
        self._closedWindowsManager = None
        self._protocolHandlerManager = None
        self._html5PermissionsManager = None
        self._desktopNotifications = None  # DesktopNotificationsFactory
        self._webProfile = None  # QWebEngineProfile

        self._autoSaver = None
        self._proxyStyle = None
        self._wmClass = QByteArray()

        self._windows = []
        self._lastActiveWindow = None
        self._postLaunchActions = []

        self.setAttribute(Qt.AA_UseHighDpiPixmaps)
        self.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)

        self.setApplicationName('demo')
        self.setOrganizationDomain('org.autowin')
        self.setWindowIcon(QIcon.fromTheme('demo', QIcon(':/icons/demo.svg')))
        self.setDesktopFileName('orig.autowin.demo')

        self.setApplicationVersion('1.0')

        # Set fallback icon theme (eg. on Windows/Mac)
        if QIcon.fromTheme('view-refresh').isNull():
            QIcon.setThemeName('breeze-fallback')

        # QSQLITE database plugin is required
        if not QSqlDatabase.isDriverAvailable('QSQLITE'):
            QMessageBox.Critical(
                None, 'Error', 'Qt SQLite database plugin is not available.'
                ' Please install it and restart the application.')
            self._isClosing = True
            return
        if const.OS_WIN:
            # Set default app font (needed for N'ko)
            fontId = QFontDatabase.addApplicationFont('font.ttf')
            if fontId != -1:
                families = QFontDatabase.applicationFontFamilies(fontId)
                if not families.empty():
                    self.setFont(QFont(families.at(0)))

        startUrl = QUrl()
        startProfile = ''
        messages = []

        noAddons = False
        newInstance = False

        if len(argv) > 1:
            cmd = CommandLineOptions()
            for pair in cmd.getActions():
                action = pair.action
                text = pair.text
                if action == const.CL_StartWithoutAddons:
                    noAddons = True
                elif action == const.CL_StartWithProfile:
                    startProfile = text
                elif action == const.CL_StartPortable:
                    self._isPortable = True
                elif action == const.CL_NewTab:
                    messages.append("ACTION:NewTab")
                    self._postLaunchActions.append(self.OpenNewTab)
                elif action == const.CL_NewWindow:
                    messages.append("ACTION:NewWindow")
                elif action == const.CL_ToggleFullScreen:
                    messages.append("ACTION:ToggleFullScreen")
                    self._postLaunchActions.append(self.ToggleFullScreen)
                elif action == const.CL_ShowDownloadManager:
                    messages.append("ACTION:ShowDownloadManager")
                    self._postLaunchActions.append(self.OpenDownloadManager)
                elif action == const.CL_StartPrivateBrowsing:
                    self._isPrivate = True
                elif action == const.CL_StartNewInstance:
                    newInstance = True
                elif action == const.CL_OpenUrlInCurrentTab:
                    startUrl = QUrl.fromUserInput(text)
                    messages.append("ACTION:OpenUrlInCurrentTab" + text)
                elif action == const.CL_OpenUrlInNewWindow:
                    startUrl = QUrl.fromUserInput(text)
                    messages.append("ACTION:OpenUrlInNewWindow" + text)
                elif action == const.CL_OpenUrl:
                    startUrl = QUrl.fromUserInput(text)
                    messages.append("URL:" + text)
                elif action == const.CL_ExitAction:
                    self._isClosing = True
                    return
                elif action == const.CL_WMClass:
                    self._wmClass = text

        if not self.isPortable():
            appConf = QSettings(
                pathjoin(self.applicationDirPath(), '%s.conf' % const.APPNAME),
                QSettings.IniFormat)
            appConf.value('Config/Portable')

        if self.isPortable():
            print('%s: Running in Portable Mode.' % const.APPNAME)
            DataPaths.setPortableVersion()

        # Don't start single application in private browsing
        if not self.isPrivate():
            appId = 'org.autowin.mc'

            if self.isPortable():
                appId += '.Portable'

            if self.isTestModeEnabled():
                appId += '.TestMode'

            if newInstance:
                if not startProfile or startProfile == 'default':
                    print(
                        'New instance cannot be started with default profile!')
                else:
                    # Generate unique appId so it is possible to start more
                    # separate instances of the same profile. It is dangerous to
                    # run more instance of the same profile, but if the user
                    # wants it, we should allow it.
                    appId += '.' + str(QDateTime.currentMSecsSinceEpoch())

            self.setAppId(appId)

        # If there is nothing to tell other instance, we need to at least weak it
        if not messages:
            messages.append(' ')

        if self.isRunning():
            self._isClosing = True
            for message in messages:
                self.sendMessage(message)
            return

        if const.OS_MACOS:
            self.setQuitOnLastWindowClosed(False)
            # TODO:
            # disable tabbing issue #2261
            # extern void disableWindowTabbing();
            # self.disableWindowTabbing()
        else:
            self.setQuitOnLastWindowClosed(True)

        QSettings.setDefaultFormat(QSettings.IniFormat)
        QDesktopServices.setUrlHandler('http', self.addNewTab)
        QDesktopServices.setUrlHandler('https', self.addNewTab)
        QDesktopServices.setUrlHandler('ftp', self.addNewTab)

        profileManager = ProfileManager()
        profileManager.initConfigDir()
        profileManager.initCurrentProfile(startProfile)

        Settings.createSettings(
            pathjoin(DataPaths.currentProfilePath(), 'settings.ini'))

        NetworkManager.registerSchemes()

        if self.isPrivate():
            self._webProfile = QWebEngineProfile()
        else:
            self._webProfile = QWebEngineProfile.defaultProfile()
        self._webProfile.downloadRequested.connect(self.downloadRequested)

        self._networkManager = NetworkManager(self)

        self.setupUserScripts()

        if not self.isPrivate() and not self.isTestModeEnabled():
            self._sessionManager = SessionManager(self)
            self._autoSaver = AutoSaver(self)
            self._autoSaver.save.connect(
                self._sessionManager.autoSaveLastSession)

            settings = Settings()
            settings.beginGroup('SessionRestore')
            wasRunning = settings.value('isRunning', False)
            wasRestoring = settings.value('isRestoring', False)
            settings.setValue('isRunning', True)
            settings.setValue('isRestoring', wasRunning)
            settings.endGroup()
            settings.sync()

            self._isStartingAfterCrash = bool(wasRunning and wasRestoring)

            if wasRunning:
                QTimer.singleShot(
                    60 * 1000, lambda: Settings().setValue(
                        'SessionRestore/isRestoring', False))

            # we have to ask about startup session before creating main window
            if self._isStartingAfterCrash and self.afterLaunch(
            ) == self.SelectSession:
                self._restoreManager = RestoreManager(
                    self.sessionManager().askSessionFromUser())

        self.loadSettings()

        self._plugins = PluginProxy(self)
        self._autoFill = AutoFill(self)
        self.app.protocolHandlerManager()

        if not noAddons:
            self._plugins.loadPlugins()

        window = self.createWindow(const.BW_FirstAppWindow, startUrl)
        window.startingCompleted.connect(self.restoreOverrideCursor)

        self.focusChanged.connect(self.onFocusChanged)

        if not self.isPrivate() and not self.isTestModeEnabled():
            # check updates
            settings = Settings()
            checkUpdates = settings.value('Web-Browser-Settings/CheckUpdates',
                                          True)

            if checkUpdates:
                Updater(window)

            self.sessionManager().backupSavedSessions()

            if self._isStartingAfterCrash or self.afterLaunch(
            ) == self.RestoreSession:
                self._restoreManager = RestoreManager(
                    self.sessionManager().lastActiveSessionPath())
                if not self._restoreManager.isValid():
                    self.destroyRestoreManager()

            if not self._isStartingAfterCrash and self._restoreManager:
                self.restoreSession(window, self._restoreManager.restoreData())

        QSettings.setPath(QSettings.IniFormat, QSettings.UserScope,
                          DataPaths.currentProfilePath())

        self.messageReceived.connect(self.messageReceivedCb)
        self.aboutToQuit.connect(self.saveSettings)

        QTimer.singleShot(0, self.postLaunch)
Exemplo n.º 23
0
 def __init__(self, organization, product):
     self.config = QSettings(organization, product)
Exemplo n.º 24
0
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout, QFormLayout, QLabel, QLineEdit, QHBoxLayout, QVBoxLayout
from PyQt5.QtGui import *
from PyQt5.Qt import *
from PyQt5.Qt import QSettings
from PyQt5.QtCore import QObject,pyqtSignal
from PyQt5.QtCore import QThread
import game as gm
import client
import json

# non blocking subcriber
# https://stackoverflow.com/questions/26012132/zero-mq-socket-recv-call-is-blocking


settings = QSettings("artifice.ini", QSettings.IniFormat)
if not settings.value("ip_client"):
    settings.setValue("ip_client", "127.0.0.1")

class Artifice(QMainWindow):

    def __init__(self):
        QMainWindow.__init__(self)
        self.content = Fenetre()
        self.setCentralWidget(self.content)
        # self.setStyleSheet("QPushButton {border: none; text-decoration: none;} "
        #                    "QPushButton:hover {border: none; text-decoration: underline; image: url(images/b1.png);}")
        # self.setStyleSheet("QPushButton {border: 1px solid red;}")
        # self.setStyleSheet("QCarte:pressed {border: 1px solid red;}")
        # self.setStyleSheet("QPushButton:checked {border-style: outset; border-width: 10px;}")
        # self.setStyleSheet("QCarte:clicked {border-style: outset; border-width: 10px;}")
Exemplo n.º 25
0
 def startingProfile(cls):
     '''
     @brief: Name of starting profile
     '''
     settings = QSettings(pathjoin(DataPaths.path(DataPaths.Profiles), 'profiles.ini'), QSettings.IniFormat)
     return settings.value('Profiles/startProfile', 'default')
Exemplo n.º 26
0
 def closeEvent(self, *args, **kwargs):
     settings = QSettings()
     settings.setValue("Geometry", QtCore.QVariant(self.saveGeometry()))
     print("geschlossen")
     return QtWidgets.QMainWindow.closeEvent(self, *args, **kwargs)
Exemplo n.º 27
0
 def setSettingsValue(key, val):
     syslog.syslog(
         syslog.LOG_DEBUG,
         "DEBUG  setSettingsValue %s, value: %s" % (key, str(val)))
     s = QSettings()
     s.setValue(key, val)
Exemplo n.º 28
0
    def __init__(self, iface, mainWindow=None):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # store references to important stuff from QGIS
        self.iface = iface
        self.canvas = iface.mapCanvas()
        self._project = QgsProject.instance()

        self._observingLayer = None

        self._uiHook = mainWindow if isinstance(mainWindow,
                                                QMainWindow) else iface

        # region: LOCALE - UNUSED
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        #
        #initialize locale
        localeString = QSettings().value('locale/userLocale')
        if (localeString):
            locale = localeString[0:2]
        else:
            locale = QLocale().language()

        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'coordinator_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)
            QCoreApplication.installTranslator(self.translator)
        # endregion

        # plugin housekeeping:
        self.openPanelAction = None
        self.pluginIsActive = False
        self.dockwidget = None

        # Init CRS Transformation:
        self._inputCrs = None
        self._outputCrs = None

        # self._transform : input -> output transformation
        # self._canvasTransform: input -> canvas transformation
        self.__initTransformers()

        # initialize canvas marker icon:
        self.marker = QgsVertexMarker(self.canvas)
        self.marker.hide()
        self.marker.setColor(QColor(255, 0, 0))
        self.marker.setIconSize(14)
        self.marker.setIconType(
            QgsVertexMarker.ICON_CIRCLE
        )  # See the enum IconType from http://www.qgis.org/api/classQgsVertexMarker.html
        self.marker.setPenWidth(3)

        # init point picker:
        self.mapTool = QgsMapToolEmitPoint(self.canvas)
Exemplo n.º 29
0
	def __init__(self, parent=None):
		QNetworkCookieJar.__init__(self, parent)
		self.storage = QSettings(QSettings.IniFormat, QSettings.UserScope, "fbreader", "plugin")
		self.loadCookies()