Ejemplo n.º 1
0
 def __init__(self, parent=None):
     super(MainWindow, self).__init__(parent)
     self.dummy_logger = None
     self.ui = uic.loadUi(get_ui_file('main_window.ui'), self)
     # Read configuration
     self.settings = QtCore.QSettings()
     self.settings.beginGroup('main_window')
     try:
         self.resize(self.settings.value('size', QtCore.QSize(640, 480)))
         self.move(self.settings.value('position', QtCore.QPoint(100, 100)))
     finally:
         self.settings.endGroup()
     # Configure status bar elements
     self.ui.progress_label = QtGui.QLabel('')
     self.statusBar().addWidget(self.ui.progress_label)
     self.progress_index = 0
     self.ui.quit_action.setIcon(get_icon('application-exit'))
     self.ui.about_action.triggered.connect(self.about)
     self.ui.about_action.setIcon(get_icon('help-about'))
     self.ui.about_qt_action.triggered.connect(self.about_qt)
     self.ui.about_qt_action.setIcon(get_icon('help-about'))
     self.ui.status_bar_action.triggered.connect(self.toggle_status)
     self.ui.view_menu.aboutToShow.connect(self.update_status)
Ejemplo n.º 2
0
  def __init__(self, parent=None):
    super(MainWindow, self).__init__(parent)
    setting = QtCore.QSettings()
    layout = QtGui.QGridLayout()
    layout.setMargin(1)
    layout.setSpacing(1)
    self.button = []
    for r in range(16):
      self.button.append( [] )
      for c in range(16):
        self.button[r].append( MyButton() )
        self.button[r][c].setFixedSize(20,20)
        self.button[r][c].row = r
        self.button[r][c].col = c
        self.button[r][c].parent = self
        self.button[r][c].revealed = False
        layout.addWidget( self.button[r][c], r, c)
    mainLayout = QtGui.QGridLayout()

    mainLayout.addLayout(layout,1,0)

    self.setLayout(mainLayout)
    self.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize)
Ejemplo n.º 3
0
    def __init__(self, main_window):
        QtCore.QObject.__init__(self)

        # ########## Reference to top level window ##########
        self.main_window = main_window

        # ########## Get the settings instance ##########
        self.settings = QtCore.QSettings()

        # ########## Reference to main_window gui elements ##########
        self.local_video_le = self.main_window.local_video_line_edit
        self.local_video_bb = self.main_window.local_video_browse_button

        self.video_transfer_le = self.main_window.video_transfer_line_edit
        self.video_transfer_bb = self.main_window.video_transfer_browse_button

        self.local_csv_le = self.main_window.local_csv_line_edit
        self.local_csv_bb = self.main_window.local_csv_browse_button

        self.csv_transfer_le = self.main_window.csv_transfer_line_edit
        self.csv_transfer_bb = self.main_window.csv_transfer_browse_button

        self.local_jpg_le = self.main_window.local_jpg_line_edit
        self.local_jpg_bb = self.main_window.local_jpg_browse_button

        self.jpg_transfer_le = self.main_window.jpg_transfer_line_edit
        self.jpg_transfer_bb = self.main_window.jpg_transfer_browse_button

        self.process_csv_te = self.main_window.process_csv_time_edit
        self.transfer_te = self.main_window.transfer_time_edit
        self.cleanup_age_sb = self.main_window.cleanup_age_spin_box

        # ########## Load all saved schedules ##########
        self.load_saved_settings()

        # ########## Connect buttons to methods ##########
        self.connect_signals_to_slots()
Ejemplo n.º 4
0
    def process_start(self):
        """Start rtl_power_fftw process"""
        if not self.process and self.params:
            settings = QtCore.QSettings()
            cmdline = [
                settings.value("executable", "rtl_power_fftw"),
                "-f",
                "{}M:{}M".format(self.params["start_freq"],
                                 self.params["stop_freq"]),
                "-b",
                "{}".format(self.params["bins"]),
                "-t",
                "{}".format(self.params["time"]),
                "-d",
                "{}".format(self.params["device"]),
                "-r",
                "{}".format(self.params["sample_rate"]),
                "-p",
                "{}".format(self.params["ppm"]),
            ]

            if self.params["gain"] >= 0:
                cmdline.extend(["-g", "{}".format(self.params["gain"])])
            if self.params["overlap"] > 0:
                cmdline.extend(["-o", "{}".format(self.params["overlap"])])
            if not self.params["single_shot"]:
                cmdline.append("-c")

            additional_params = settings.value("params",
                                               Info.additional_params)
            if additional_params:
                cmdline.extend(shlex.split(additional_params))

            self.process = subprocess.Popen(cmdline,
                                            stdout=subprocess.PIPE,
                                            stderr=subprocess.DEVNULL,
                                            universal_newlines=True)
Ejemplo n.º 5
0
    def __init__(self, iface):
        """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: QgisInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        loc = QtCore.QSettings().value('locale/userLocale', 'en')
        locale = loc[0:2]

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

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&TrendMapper')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'TrendMapper')
        if self.toolbar is None:
            pass
        else:
            self.toolbar.setObjectName(u'TrendMapper')
        self.totalCounter = 1
        self.counter = 0
Ejemplo n.º 6
0
Archivo: main.py Proyecto: lind9/hexrd
    def __init__(self, log_level, cfg_file=None):
        super(MainController, self).__init__()
        # Create and display the splash screen
        splash_pix = QtGui.QPixmap(resources['hexrd.png'])
        splash = QtGui.QSplashScreen(splash_pix)
        splash.setMask(splash_pix.mask())
        splash.show()
        # sleep seems necessary on linux to render the image
        time.sleep(0.01)
        QtGui.qApp.processEvents()

        self._preferences = get_preferences()

        uic.loadUi(resources['mainwindow.ui'], self)
        self.menuHelp.addAction(QtGui.QWhatsThis.createAction(self))
        self._configure_tool_buttons()

        # now that we have the ui, configure the logging widget
        add_handler(log_level, QLogStream(self.loggerTextEdit))

        self.gc_ctlr = GraphicsCanvasController(self)

        self.load_config(cfg_file)

        self.settings = QtCore.QSettings('hexrd', 'hexrd')
        self._restore_state()
        self._configure_dock_widgets()

        # load all ui elements before loading the event filters
        self._load_event_filters()

        # give the splash screen a little time to breathe
        time.sleep(1)

        self.show()

        splash.finish(self)
Ejemplo n.º 7
0
 def __init__(self, mainwin, startPath, parent=None):
     super(BuildSettingsDialog, self).__init__(parent)
     self.mainWindow = mainwin
     uis.loadDialog('build_settings', self)
     s = QtCore.QSettings()
     check(self.parallelCB, s.value('parallel_make', False).toBool())
     check(self.symscanCB, s.value('symbol_scan', True).toBool())
     self.tabWidget.clear()
     self.tabs = []
     for t in tabs:
         desc = tabs.get(t)
         dlg = SettingsTabDialog()
         dlg.addWidgets(desc, self)
         self.tabs.append((t, dlg))
     for (name, tab) in self.tabs:
         self.tabWidget.addTab(tab, name)
     self.workspaceItem = QtGui.QTreeWidgetItem(['Workspace'])
     self.mainWindow.workspaceTree.addProjectsToTree(self.workspaceItem)
     self.workspaceDir = self.workspaceItem.data(0,
                                                 DirectoryRole).toString()
     self.projTree.addTopLevelItem(self.workspaceItem)
     self.workspaceItem.setExpanded(True)
     self.projTree.itemSelectionChanged.connect(self.selectionChanged)
     self.closeButton.clicked.connect(self.closeClicked)
     self.resetButton.clicked.connect(self.resetClicked)
     self.prevPath = ''
     firstItem = None
     if startPath == self.workspaceDir:
         firstItem = self.workspaceItem
     else:
         firstItem = self.findItem(self.workspaceItem, startPath)
     if not firstItem:
         firstItem = self.workspaceItem
     self.projTree.setCurrentItem(firstItem)
     self.projTree.scrollToItem(firstItem)
     dir = firstItem.data(0, DirectoryRole).toString()
     self.prevPath = os.path.join(dir, 'mk.cfg')
Ejemplo n.º 8
0
    def __retrieveConfigurables(self):
        '''Run at startup and after the preferences dialog exits'''
        settings = QtCore.QSettings('vcs', 'qct')
        self.signoff = settings.value('signoff', QtCore.QVariant('')).toString()
        settings.beginGroup('fileList')
        self.showIgnored = settings.value('showIgnored', QtCore.QVariant(False)).toBool()
        self.wrapList = settings.value('wrapping', QtCore.QVariant(False)).toBool()
        settings.endGroup()

        settings.beginGroup('tools')
        self.histTool = str(settings.value('histTool', QtCore.QVariant('')).toString())
        self.diffTool = str(settings.value('diffTool', QtCore.QVariant('')).toString())
        self.editTool = str(settings.value('editTool', QtCore.QVariant('')).toString())
        self.twowayTool = str(settings.value('twowayTool', QtCore.QVariant('')).toString())
        settings.endGroup()

        # Disable the 'show ignored' feature if VCS does not support it (perforce)
        if 'ignore' not in self.vcs.capabilities():
            self.showIgnored = False

        if self.ui.histButton and not self.histTool:
            self.ui.hboxlayout2.removeWidget(self.ui.histButton)
            self.ui.histButton = None
        elif self.histTool and not self.ui.histButton:
            self.ui.histButton = QtGui.QPushButton(self)
            self.ui.histButton.setObjectName("histButton")
            self.ui.histButton.setText("History")
            self.ui.hboxlayout2.insertWidget(1, self.ui.histButton)
            self.connect(self.ui.histButton, QtCore.SIGNAL("clicked()"), self.__history)

        if self.wrapList:
            self.ui.fileListWidget.setWrapping( True )
            self.ui.fileListWidget.setFlow( QtGui.QListView.LeftToRight )
            # self.ui.fileListWidget.setUniformItemSizes( True )
        else:
            self.ui.fileListWidget.setWrapping( False )
            self.ui.fileListWidget.setFlow( QtGui.QListView.TopToBottom )
Ejemplo n.º 9
0
    def test_user_defined_extent(self):
        """Test that analysis honours user defined extents.

        Note that when testing on a desktop system this will overwrite your
        user defined analysis extent.
        """

        settings = QtCore.QSettings()
        extent = (
            'POLYGON (('
            '106.772279 -6.237576, '
            '106.772279 -6.165415, '
            '106.885165 -6.165415, '
            '106.885165 -6.237576, '
            '106.772279 -6.237576'
            '))')
        settings.setValue('inasafe/user_extent', extent)
        settings.setValue('inasafe/user_extent_crs', 'EPSG:4326')
        self.dock.read_settings()

        setup_scenario(
            self.dock,
            hazard='Continuous Flood',
            exposure='Population',
            aggregation_layer=u'D\xedstr\xedct\'s of Jakarta',
            aggregation_enabled_flag=True)

        self.dock.extent.show_rubber_bands = True
        expected_vertex_count = 2

        # 4326 with disabled on-the-fly reprojection
        set_canvas_crs(GEOCRS, True)
        # User extent should override this
        set_small_jakarta_extent(self.dock)
        self.dock.extent.display_user_extent()
        user_band = self.dock.extent._user_analysis_rubberband
        self.assertEqual(expected_vertex_count, user_band.numberOfVertices())
Ejemplo n.º 10
0
 def __init__(self):
     QMainWindow.__init__(self)
     QIcon.setThemeName('Adwaita')
     self.setupUi(self)
     self.settings = QtCore.QSettings(1, 0, "daaq-mail","daaq", self)
     self.emails = [unicode(x) for x in self.settings.value('Emails', []).toStringList()]
     self.types = [unicode(x) for x in self.settings.value('Types', []).toStringList()]
     self.initUi()
     self.resize(1024, 714)
     self.show()
     # create imap client
     self.thread = QtCore.QThread(self)
     self.imapClient = GmailImap()
     self.thread.finished.connect(self.imapClient.deleteLater)
     self.imapClient.moveToThread(self.thread)
     self.imapClient.loggedIn.connect(           self.onLogin)
     self.imapClient.mailboxListLoaded.connect(  self.setMailboxes)
     self.imapClient.mailboxSelected.connect(    self.onMailboxSelect)
     self.imapClient.uidsListed.connect(         self.removeDeleted)
     self.imapClient.insertMailRequested.connect(self.insertNewMail)
     self.imapClient.bodystructureLoaded.connect(self.setAttachments)
     self.imapClient.mailTextLoaded.connect(     self.setMailText)
     self.loginRequested.connect(                self.imapClient.login)
     self.selectMailboxRequested.connect(        self.imapClient.selectMailbox)
     self.uidListRequested.connect(              self.imapClient.listUids)
     self.newMailsRequested.connect(             self.imapClient.getNewMails)
     self.bodystructureRequested.connect(        self.imapClient.loadBodystructure)
     self.mailTextRequested.connect(             self.imapClient.loadMailText)
     self.saveAttachmentRequested.connect(        self.imapClient.saveAttachment)
     self.deleteRequested.connect(               self.imapClient.deleteMails)
     self.thread.start()
     # init variables
     self.email_id = ''
     self.passwd = ''
     self.mailbox = ''
     self.total_mails = 0
     QtCore.QTimer.singleShot(30, self.setupClient)
Ejemplo n.º 11
0
    def save_settings(self, ini_name):
        """
        Technique structured from the code from: "https://stackoverflow.com
        /questions/23279125/python-pyqt4-functions-to-save-and-restore-ui-
        widget-values"

        :param ini_name: Name of the .ini file (Ex. pysecmaster.ini)
        :return:
        """

        settings = QtCore.QSettings(ini_name, QtCore.QSettings.IniFormat)

        # For child in ui.children():  # works like getmembers, but because it
        # traverses the hierarchy, you would have to call the method recursively
        # to traverse down the tree.

        for name, obj in inspect.getmembers(self):
            if isinstance(obj, QtGui.QComboBox):
                name = obj.objectName()
                text = obj.currentText()
                settings.setValue(name, text)

            elif isinstance(obj, QtGui.QLineEdit):
                name = obj.objectName()
                value = obj.text()
                settings.setValue(name, value)

            elif isinstance(obj, QtGui.QSpinBox):
                name = obj.objectName()
                value = obj.value()
                settings.setValue(name, value)

            elif isinstance(obj, QtGui.QCheckBox):
                name = obj.objectName()
                state = obj.checkState()
                settings.setValue(name, state)
Ejemplo n.º 12
0
def showSnapSettingsWarning():
    #get the setting for displaySnapWarning
    settings = QtCore.QSettings()
    settingsLabel = "/UI/displaySnapWarning"
    displaySnapWarning = settings.value(settingsLabel, False, type=bool)

    #only show the warning if the setting is true
    if displaySnapWarning:
        m = QgsMessageViewer()
        m.setWindowTitle(
            QtCore.QCoreApplication.translate("digitizingtools",
                                              "Snap Tolerance"))
        m.setCheckBoxText(
            QtCore.QCoreApplication.translate("digitizingtools",
                                              "Don't show this message again"))
        m.setCheckBoxVisible(True)
        m.setCheckBoxQSettingsLabel(settingsLabel)
        m.setMessageAsHtml(
            "<p>" + QtCore.QCoreApplication.translate(
                "digitizingtools", "Could not snap vertex") + "</p><p>" +
            QtCore.QCoreApplication.translate(
                "digitizingtools",
                "Have you set the tolerance in Settings > Snapping Options?"))
        m.showMessage()
Ejemplo n.º 13
0
    def __init__(self, specRunner, parent=None):
        QtGui.QWidget.__init__(self, parent)
        uic.loadUi(resources['skipmode.ui'], self)

        self.specRunner = specRunner

        settings = QtCore.QSettings()
        settings.beginGroup("SkipModeOptions")

        val = settings.value('threshold', QtCore.QVariant(0)).toInt()[0]
        self.thresholdSpinBox.setValue(val)

        val = settings.value('precount', QtCore.QVariant(0)).toDouble()[0]
        self.precountSpinBox.setValue(val)

        counters = [''] + self.specRunner.getCountersMne()
        self.counterComboBox.addItems(counters)
        try:
            i = counters.index(settings.value('counter').toString())
            self.counterComboBox.setCurrentIndex(i)
        except ValueError:
            pass

        self.specRunner.specBusy.connect(self.setBusy)
Ejemplo n.º 14
0
    def writeSettings(self):
        settings = QtCore.QSettings()
        settings.setValue("AddressArea", self.ui.cbAddressArea.isChecked())
        settings.setValue("AsciiArea", self.ui.cbAsciiArea.isChecked())
        settings.setValue("Highlighting", self.ui.cbHighlighting.isChecked())
        settings.setValue("OverwriteMode", self.ui.cbOverwriteMode.isChecked())
        settings.setValue("ReadOnly", self.ui.cbReadOnly.isChecked())

        settings.setValue(
            "HighlightingColor",
            self.ui.lbHighlightingColor.palette().color(
                QtGui.QPalette.Background))
        settings.setValue(
            "AddressAreaColor",
            self.ui.lbAddressAreaColor.palette().color(
                QtGui.QPalette.Background))
        settings.setValue(
            "SelectionColor",
            self.ui.lbSelectionColor.palette().color(
                QtGui.QPalette.Background))
        settings.setValue("WidgetFont", self.ui.leWidgetFont.font())

        settings.setValue("AddressAreaWidth",
                          self.ui.sbAddressAreaWidth.value())
Ejemplo n.º 15
0
 def save_state(self):
     """Store the options into the user's stored session info.
     """
     mySettings = QtCore.QSettings()
     mySettings.setValue('inasafe/useThreadingFlag', False)
     mySettings.setValue('inasafe/visibleLayersOnlyFlag',
                         self.cbxVisibleLayersOnly.isChecked())
     mySettings.setValue('inasafe/setLayerNameFromTitleFlag',
                         self.cbxSetLayerNameFromTitle.isChecked())
     mySettings.setValue('inasafe/setZoomToImpactFlag',
                         self.cbxZoomToImpact.isChecked())
     mySettings.setValue('inasafe/setHideExposureFlag',
                         self.cbxHideExposure.isChecked())
     mySettings.setValue('inasafe/clipToViewport',
                         self.cbxClipToViewport.isChecked())
     mySettings.setValue('inasafe/clipHard', self.cbxClipHard.isChecked())
     mySettings.setValue('inasafe/useSentry', self.cbxUseSentry.isChecked())
     mySettings.setValue('inasafe/showIntermediateLayers',
                         self.cbxShowPostprocessingLayers.isChecked())
     mySettings.setValue('inasafe/defaultFemaleRatio',
                         self.dsbFemaleRatioDefault.value())
     mySettings.setValue('inasafe/keywordCachePath',
                         self.leKeywordCachePath.text())
     mySettings.setValue('inasafe/devMode', self.cbxDevMode.isChecked())
Ejemplo n.º 16
0
    def setCurrentFile(self, fileName):
        self.curFile = fileName
        if self.curFile:
            self.setWindowTitle("%s - Recent Files" %
                                self.strippedName(self.curFile))
        else:
            self.setWindowTitle("Recent Files")

        settings = QtCore.QSettings('Trolltech', 'Recent Files Example')
        files = settings.value('recentFileList', [])

        try:
            files.remove(fileName)
        except ValueError:
            pass

        files.insert(0, fileName)
        del files[MainWindow.MaxRecentFiles:]

        settings.setValue('recentFileList', files)

        for widget in QtGui.QApplication.topLevelWidgets():
            if isinstance(widget, MainWindow):
                widget.updateRecentFileActions()
Ejemplo n.º 17
0
    def saveSettings(self):
        '''
        save settings from QtCore.QSettings
        '''
        LOGGER.debug("saving settings")
        qsettings = QtCore.QSettings()
        #Qt settings
        qsettings.setValue("geometry", self.saveGeometry())
        qsettings.setValue("windowState", self.saveState())
        qsettings.setValue("statusbar_hidden", self.statusbar.isHidden())
        qsettings.setValue("Font", self.font())
        qsettings.setValue("Toolbar", self.main_toolbar.toolButtonStyle())
        qsettings.setValue("TinyMenu", not self.menuBar().isVisible())

        # SETTINGS.PERSISTANT_SETTINGS is a python dict of non qt-specific settings.
        # unfortunately.. QVariant.toPyObject can't recreate a dictionary
        # so best to pickle this
        pickled_dict = pickle.dumps(SETTINGS.PERSISTANT_SETTINGS)
        qsettings.setValue("settings_dict", pickled_dict)

        qsettings.setValue("allow_naked_plugins_in_home_dir",
                           SETTINGS.ALLOW_NAKED_PLUGINS)
        qsettings.setValue("active_plugins",
                           QtCore.QStringList(list(SETTINGS.ACTIVE_PLUGINS)))
Ejemplo n.º 18
0
    def setUp(self):
        """Fixture run before all tests"""
        register_impact_functions()

        self.dock.show_only_visible_layers_flag = True
        load_standard_layers(self.dock)
        self.dock.cboHazard.setCurrentIndex(1)
        self.dock.cboExposure.setCurrentIndex(0)
        self.dock.cboFunction.setCurrentIndex(0)
        self.dock.run_in_thread_flag = False
        self.dock.show_only_visible_layers_flag = False
        self.dock.set_layer_from_title_flag = False
        self.dock.zoom_to_impact_flag = False
        self.dock.hide_exposure_flag = False
        self.dock.show_intermediate_layers = False
        self.dock.user_extent = None
        self.dock.user_extent_crs = None
        # For these tests we will generally use explicit overlap
        # between hazard, exposure and view, so make that default
        # see also safe/test/utilities.py where this is globally
        # set to HazardExposure
        settings = QtCore.QSettings()
        settings.setValue('inasafe/analysis_extents_mode',
                          'HazardExposureView')
Ejemplo n.º 19
0
    def __init__(self, parent, standAlone=True, app=None):
        super(MainManager, self).__init__(parent)

        self.ui = Ui_MainManager()
        self.app = app

        if standAlone:
            self.ui.setupUi(self)
            self.parent = self
        else:
            self.ui.setupUi(parent)
            self.parent = parent

        self.settings = QtCore.QSettings()

        self.animator = QTimeLine(ANIMATION_TIME, self)
        self.lastAnimation = SHOW

        self.tweakUi()

        self.last_item = None
        self.checkMsgClicks = False

        self.cface = ComarIface()
        self.pface = PisiIface(self)
        self.config = ConfigWindow(self)
        self.loaded = 0

        self.connectSignals()

        self.ui.textEdit.installEventFilter(self)
        self.ui.lw.installEventFilter(self)
        self.ui.opTypeLabel.installEventFilter(self)

        self.cface.listen(self.handler)
        self.pface.start()
Ejemplo n.º 20
0
 def __init__(self, canvas):
     QgsMapTool.__init__(self, canvas)
     self.canvas=canvas
     self.marker = None
     self.rubberBand = None
     settings = QtCore.QSettings()
     settings.beginGroup("Qgis/digitizing")
     a = settings.value("line_color_alpha",200,type=int)
     b = settings.value("line_color_blue",0,type=int)
     g = settings.value("line_color_green",0,type=int)
     r = settings.value("line_color_red",255,type=int)
     lw = settings.value("line_width",1,type=int)
     settings.endGroup()
     self.rubberBandColor = QtGui.QColor(r, g, b, a)
     self.rubberBandWidth = lw
     self.cursor = QtGui.QCursor(QtGui.QPixmap(["16 16 3 1",
                               "      c None",
                               ".     c #000000",
                               "+     c #FFFFFF",
                               "                ",
                               "       +.+      ",
                               "      ++.++     ",
                               "     +.....+    ",
                               "    +.     .+   ",
                               "   +.   .   .+  ",
                               "  +.    .    .+ ",
                               " ++.    .    .++",
                               " ... ...+... ...",
                               " ++.    .    .++",
                               "  +.    .    .+ ",
                               "   +.   .   .+  ",
                               "   ++.     .+   ",
                               "    ++.....+    ",
                               "      ++.++     ",
                               "       +.+      "]))
     self.reset()
Ejemplo n.º 21
0
    def readSettings(self):
        settings = QtCore.QSettings()

        self.ui.cbAddressArea.setChecked(
            settings.value("AddressArea", True).toBool())
        self.ui.cbAsciiArea.setChecked(
            settings.value("AsciiArea", True).toBool())
        self.ui.cbHighlighting.setChecked(
            settings.value("Highlighting", True).toBool())
        self.ui.cbOverwriteMode.setChecked(
            settings.value("OverwriteMode", True).toBool())
        self.ui.cbReadOnly.setChecked(
            settings.value("ReadOnly", False).toBool())

        self.setColor(
            self.ui.lbHighlightingColor,
            QtGui.QColor(
                settings.value("HighlightingColor",
                               QtGui.QColor(0xff, 0xff, 0x99, 0xff))))
        self.setColor(
            self.ui.lbAddressAreaColor,
            QtGui.QColor(
                settings.value("AddressAreaColor",
                               QtGui.QColor(0xd4, 0xd4, 0xd4, 0xff))))
        self.setColor(
            self.ui.lbSelectionColor,
            QtGui.QColor(
                settings.value("SelectionColor",
                               QtGui.QColor(0x6d, 0x9e, 0xff, 0xff))))
        self.ui.leWidgetFont.setFont(
            QtGui.QFont(
                settings.value("WidgetFont",
                               QtGui.QFont(QtGui.QFont("Courier New", 10)))))

        self.ui.sbAddressAreaWidth.setValue(
            settings.value("AddressAreaWidth", 4).toInt()[0])
Ejemplo n.º 22
0
    def __init__(self, iface):
        """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
        """
        super(SpreadsheetLayersPlugin, self).__init__()
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QtCore.QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'SpreadsheetLayers_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QtCore.QTranslator()
            self.translator.load(locale_path)

            if QtCore.qVersion() > '4.3.3':
                QtCore.QCoreApplication.installTranslator(self.translator)
Ejemplo n.º 23
0
    def _load_settings(self):
        settings = QtCore.QSettings()

        settings.beginGroup("GUI")
        settings.beginGroup("MainWindow")

        super(MainWindow,
              self).restoreState(settings.value("State", QtCore.QByteArray()))

        if settings.contains("pos"):
            super(MainWindow, self).move(settings.value("pos"))

        size = settings.value("size", QtCore.QSize(1024, 768))

        super(MainWindow, self).resize(size)

        isMaximized = settings.value("IsMaximized", False) == "true"

        if isMaximized:
            super(MainWindow, self).setWindowState(QtCore.Qt.WindowMaximized)

        settings.endGroup()

        states_count = settings.beginReadArray("States")
        for i in range(states_count):
            settings.setArrayIndex(i)
            self._states.append_state(settings.value("Name"),
                                      settings.value("Data"))
        settings.endArray()

        state_name = settings.value("CurrentState", str())
        if state_name:
            self._current_state = self._states.state_for_name(state_name)
            super(MainWindow, self).restoreState(self._current_state.data())

        settings.endGroup()
Ejemplo n.º 24
0
    def __init__(self, parent=None):
        # initialization of the superclass
        super(DesignerMainWindow, self).__init__(parent)
        # setup the GUI --> function generated by pyuic4
        self.setupUi(self)

        self.tabWidget.setCurrentIndex(
            1)  # sets which tab is preferred when first opened.

        bling = ['VI', 'EI', 'NI']
        self.inc_curve = self.curveComboBox_1.addItems(sorted(bling))
        self.fdr1_curve = self.curveComboBox_2.addItems(sorted(bling))
        self.fdr2_curve = self.curveComboBox_3.addItems(sorted(bling))

        self.initUI()

        #self.QwtWidget.show()

        self.dirty = True
        settings = QtCore.QSettings()
        self.restoreGeometry(
            settings.value("Geometry").toByteArray())  # method of QWidget
        self.restoreState(settings.value(
            "MainWindow/State").toByteArray())  # method of QManWindow
Ejemplo n.º 25
0
 def populateSchemas(self):
     if self.childCount() != 0:
         return
     settings = QtCore.QSettings()
     connSettings = '/PostgreSQL/connections/' + self.connection
     database = settings.value(connSettings + '/database')
     user = settings.value(connSettings + '/username')
     host = settings.value(connSettings + '/host')
     port = settings.value(connSettings + '/port')
     passwd = settings.value(connSettings + '/password')
     uri = QgsDataSourceURI()
     uri.setConnection(host, str(port), database, user, passwd)
     connInfo = uri.connectionInfo()
     (success, user,
      passwd) = QgsCredentials.instance().get(connInfo, None, None)
     if success:
         QgsCredentials.instance().put(connInfo, user, passwd)
         geodb = GeoDB(host, int(port), database, user, passwd)
         schemas = geodb.list_schemas()
         for oid, name, owner, perms in schemas:
             item = QtGui.QTreeWidgetItem()
             item.setText(0, name)
             item.setIcon(0, self.schemaIcon)
             self.addChild(item)
Ejemplo n.º 26
0
    def __init__(self):
        self.settings = QtCore.QSettings(QtCore.QSettings.IniFormat,
                                         QtCore.QSettings.UserScope, AUTHOR,
                                         APPNAME)

        #path for deck skins is like: "skins:<deck-name>"
        #so default table is "skins:{skin}/table.png"
        #deck defs are like "decks:{deck}.xml"
        #path for layouts is like "layouts:<layout-name>.lyt"

        self.userconfdir=QtGui.QDesktopServices.storageLocation\
        (QtGui.QDesktopServices.DataLocation).replace('//','/')

        app_theme_path = DECKS
        config_theme_path = os.path.join(self.userconfdir, "decks")

        app_layout_path = LAYOUTS
        config_layout_path = os.path.join(self.userconfdir, "layouts")

        app_defs_path = DECK_DEFS
        config_defs_path = os.path.join(self.userconfdir, "deck_defs")

        app_htmltpl_path = HTMLTPL
        config_htmltpl_path = os.path.join(self.userconfdir, "htmltpl")

        QtCore.QDir.setSearchPaths("layouts",
                                   [config_layout_path, app_layout_path])
        QtCore.QDir.setSearchPaths("skins",
                                   [config_theme_path, app_theme_path])
        QtCore.QDir.setSearchPaths("deckdefs",
                                   [config_defs_path, app_defs_path])
        QtCore.QDir.setSearchPaths("htmltpl",
                                   [config_htmltpl_path, app_htmltpl_path])

        self.sys_icotheme = QtGui.QIcon.themeName()
        self.reset_settings()
Ejemplo n.º 27
0
    def __init__(self, parent=None):
        # Initialize UI
        super().__init__(parent)
        self.setupUi(self)

        # Load settings
        settings = QtCore.QSettings()
        self.executableEdit.setText(settings.value("executable",
                                                   "soapy_power"))
        self.waterfallHistorySizeSpinBox.setValue(
            settings.value("waterfall_history_size", 100, int))
        self.deviceEdit.setText(settings.value("device", ""))

        backend = settings.value("backend", "soapy_power")
        try:
            backend_module = getattr(backends, backend)
        except AttributeError:
            backend_module = backends.soapy_power

        self.sampleRateSpinBox.setMinimum(backend_module.Info.sample_rate_min)
        self.sampleRateSpinBox.setMaximum(backend_module.Info.sample_rate_max)
        self.sampleRateSpinBox.setValue(
            settings.value("sample_rate", backend_module.Info.sample_rate,
                           int))

        self.backendComboBox.clear()
        for b in sorted(backends.__all__):
            self.backendComboBox.addItem(b)

        self.backendComboBox.blockSignals(True)
        i = self.backendComboBox.findText(backend)
        if i == -1:
            self.backendComboBox.setCurrentIndex(0)
        else:
            self.backendComboBox.setCurrentIndex(i)
        self.backendComboBox.blockSignals(False)
Ejemplo n.º 28
0
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.setWindowTitle("Super Mario 3D World")
        self.setGeometry(100,100,1080,720)

        self.setupMenu()
        
        self.qsettings = QtCore.QSettings("Kinnay","SM3DW Editor")
        self.gamePath = self.qsettings.value('gamePath').toPyObject()
        if not self.isValidGameFolder(self.gamePath):
            self.changeGamePath(True)

        self.loadStageList()
        self.levelSelect = ChooseLevelDialog(self.worldList)
        
        self.settings = SettingsWidget(self)
        self.setupGLScene()
        self.resizeWidgets()

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.updateCamera)
        self.timer.start(30)

        self.show()
Ejemplo n.º 29
0
    def readSettings(self):
        settings = QtCore.QSettings('PythonCAD', 'MDI Settings')
        settings.beginGroup("CadWindow")
        max = settings.value("maximized", False)
        if max == True:  #if cadwindow was maximized set it maximized again
            self.showMaximized()
        else:  #else set it to the previous position and size
            try:
                self.resize(
                    settings.value("size")
                )  # self.resize(settings.value("size", QtCore.QSize(800, 600)).toSize())
                self.move(
                    settings.value("pos")
                )  # self.move(settings.value("pos", QtCore.QPoint(400, 300)).toPoint())+
            except:
                print "Warning: unable to set the previews values"
        settings.endGroup()

        settings.beginGroup("CadWindowState")
        try:
            self.restoreState(settings.value('State'))
        except:
            print "Warning: Unable to set state"
        settings.endGroup()
    def extractPgConnectionDetails(self):
        
        selectedConnection = self.postgisConnectionComboBox.currentText()

        if selectedConnection == 'DEBUG':
            self.dbDetails['host'] = 'localhost'
            self.dbDetails['database'] = 'ostranslator'
            self.dbDetails['user'] = '******'
            self.dbDetails['password'] = '******'
            self.dbDetails['port'] = 5432
            return
        
        s = QtCore.QSettings()
        self.dbDetails['database'] = str(s.value("PostgreSQL/connections/%s/database" % selectedConnection, '', type=str))
        if len(self.dbDetails['database']) == 0:
            # Looks like the preferred connection could not be found
            raise Exception('Details of the selected PostGIS connection could not be found, please check your settings')
        self.dbDetails['host'] = str(s.value("PostgreSQL/connections/%s/host" % selectedConnection, '', type=str))
        self.dbDetails['user'] = str(s.value("PostgreSQL/connections/%s/username" % selectedConnection, '', type=str))
        self.dbDetails['password'] = str(s.value("PostgreSQL/connections/%s/password" % selectedConnection, '', type=str))
        try:
            self.dbDetails['port'], dummy = s.value("PostgreSQL/connections/%s/port" % selectedConnection, 5432).toInt()
        except:
            self.dbDetails['port'] = int(s.value("PostgreSQL/connections/%s/port" % selectedConnection, 5432, type=int))