コード例 #1
0
class MainWindow(QtGui.QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("supervisor Interface")
        self.__mutex__ = QtCore.QMutex()

        self.__log__()
        self.__setting__()
        self.createActions()
        self.createMenus()
        self.__rpc__ = None
        self.centralWidget = CentralWidget(None, (self.settings, self.__mutex__) )

        self.statusBar().showMessage("Ready")


    def __setting__(self):
        print "get setting"
        #self.settings = QSettings(QSettings.IniFormat,QSettings.SystemScope, '__ILLUSTRABOT2OO', '__settings')
        self.settings = QSettings(QSettings.IniFormat,QSettings.UserScope, '__ILLUSTRABOT2OO', '__settings')
        self.settings.setFallbacksEnabled(False)    # File only, not registry or or.
        
        self.__mutex__.lock()
        self.settings.beginGroup("Main")
        self.resize(self.settings.value("size", QtCore.QSize(1024, 850)))
        self.move(self.settings.value("pos", QtCore.QPoint(50, 50)))
        self.ip = self.settings.value("ip",  r'172.25.195.58')
        print "previous IP=",self.ip
        
        self.settings.endGroup()
        self.__mutex__.unlock()


    def __log__(self):
        self.windowlog = {}


    def rpc(self):
        # Try to connect to a board
        print self.ip
        text, ok = QtGui.QInputDialog.getText(self, self.tr("Board IP"),
                                              self.tr("IP address:"), QtGui.QLineEdit.Normal,
                                              self.ip)

        if ok and not (len(text) ==0):
            try:
                self.__rpc__ = xmlrpclib.ServerProxy("http://%s:8000"%str(text))
                self.statusBar().showMessage("Connected...")
                self.centralWidget.setrpc(self.__rpc__) 
                self.__get_level__()
                self.setCentralWidget(self.centralWidget)
                self.ip= str(text)
            except Exception,e:
                self.statusBar().showMessage("Failed to connect to %s"%text)
                sys.stderr.write( str(e))
                traceback.print_exc(file=sys.stderr)
                pass
            

        return
コード例 #2
0
class PadApp(QApplication):
    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)
        self.settings = QSettings('everpad', 'everpad-pad')
        self.translator = QTranslator()
        if not self.translator.load('../../i18n/%s' % QLocale.system().name()):
            self.translator.load('/usr/share/everpad/i18n/%s' % QLocale.system().name())
        # This application string can be localized to 'RTL' to switch the application layout
        # direction. See for example i18n/ar_EG.ts
        QT_TRANSLATE_NOOP('QApplication', 'QT_LAYOUT_DIRECTION')
        self.installTranslator(self.translator)
        QNetworkProxyFactory.setUseSystemConfiguration(True)
        self.indicator = Indicator(self)
        self.update_icon()
        self.indicator.show()

    def update_icon(self):
        if int(self.settings.value('black-icon', 0)):
            self.icon = QIcon.fromTheme('everpad-black', QIcon('../../data/everpad-black.png'))
        else:
            self.icon = QIcon.fromTheme('everpad-mono', QIcon('../../data/everpad-mono.png'))
        self.indicator.setIcon(self.icon)

    def send_notify(self, text):
        self.indicator.showMessage('Everpad', text,
            QSystemTrayIcon.Information)

    def on_sync_state_changed(self, state):
        if bool(self.settings.value('launcher-progress', 1)):
            self.launcher.update({
                'progress': float(state + 1) / len(SYNC_STATES),
                'progress-visible': state not in (SYNC_STATE_START, SYNC_STATE_FINISH),
            })
コード例 #3
0
 def icon(self, act):
     settings = QSettings()
     iconSet = settings.value("toolbar/iconset", QtReduceDefaults.ICONSET)
     iconSize = settings.value("toolbar/iconsize",
                               QtReduceDefaults.ICONSIZE)
     if iconSet:
         iEntry = self.db[iconSet]
         text = act.iconText()
         entry = None
         if text in iEntry.keys():
             entry = iEntry[text]
         path = ''
         if entry:
             path = sys.path[0] + "/icons/" + iconSet + "/"
             if iEntry["sized"]:
                 path += str(iconSize) + "/"
             path += entry
             traceLogger.debug("iconPath=%s" % path)
         return QIcon(path)
     else:
         if mEntry == "open":
             return self.style().standardIcon(QStyle.SP_DialogOpenButton)
         elif mEntry == "save":
             return self.style().standardIcon(QStyle.SP_DialogSaveButton)
         elif mEntry == "abort":
             return self.style().standardIcon(QStyle.SP_BrowserStop)
         else:
             return QIcon('')
コード例 #4
0
    def load_ini(self):
        settings = QSettings('config.ini', QSettings.IniFormat)

        settings.beginGroup(self.__class__.__name__)
        self.restoreGeometry(settings.value('Geometry'))
        self.splitter.restoreState(settings.value('splitter'))
        settings.endGroup()
コード例 #5
0
ファイル: indicator.py プロジェクト: XelK/everpad
class PadApp(QApplication):
    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)
        self.settings = QSettings("everpad", "everpad-pad")
        self.translator = QTranslator()
        if not self.translator.load("../../i18n/%s" % QLocale.system().name()):
            self.translator.load("/usr/share/everpad/i18n/%s" % QLocale.system().name())
        # This application string can be localized to 'RTL' to switch the application layout
        # direction. See for example i18n/ar_EG.ts
        QT_TRANSLATE_NOOP("QApplication", "QT_LAYOUT_DIRECTION")
        self.installTranslator(self.translator)
        self.indicator = Indicator(self)
        self.update_icon()
        self.indicator.show()

    def update_icon(self):
        if int(self.settings.value("black-icon", 0)):
            self.icon = QIcon.fromTheme("everpad-black", QIcon("../../data/everpad-black.png"))
        else:
            self.icon = QIcon.fromTheme("everpad-mono", QIcon("../../data/everpad-mono.png"))
        self.indicator.setIcon(self.icon)

    def send_notify(self, text):
        self.indicator.showMessage("Everpad", text, QSystemTrayIcon.Information)

    def on_sync_state_changed(self, state):
        if int(self.settings.value("launcher-progress", 1)):
            self.launcher.update(
                {
                    "progress": float(state + 1) / len(SYNC_STATES),
                    "progress-visible": state not in (SYNC_STATE_START, SYNC_STATE_FINISH),
                }
            )
コード例 #6
0
ファイル: qrdefaults.py プロジェクト: webushka/reduce
 def icon(self, act):
     settings = QSettings()
     iconSet = settings.value("toolbar/iconset",QtReduceDefaults.ICONSET)
     iconSize = settings.value("toolbar/iconsize",
                                  QtReduceDefaults.ICONSIZE)
     if iconSet:
         iEntry = self.db[iconSet]
         text = act.iconText()
         entry = None
         if text in iEntry.keys():
             entry = iEntry[text]
         path = ''
         if entry:
             path = sys.path[0] + "/icons/" + iconSet + "/"
             if iEntry["sized"]:
                 path += str(iconSize) + "/"
             path += entry
             traceLogger.debug("iconPath=%s" % path)
         return QIcon(path)
     else:
         if mEntry == "open":
             return self.style().standardIcon(QStyle.SP_DialogOpenButton)
         elif mEntry == "save":
             return self.style().standardIcon(QStyle.SP_DialogSaveButton)
         elif mEntry == "abort":
             return self.style().standardIcon(QStyle.SP_BrowserStop)
         else:
             return QIcon('')
コード例 #7
0
ファイル: qrmainwindow.py プロジェクト: webushka/reduce
    def updateEntries(self):
        settings = QSettings()
        settings.sync()

        maxRecent = settings.value("menubar/maxrecent",
                                      QtReduceDefaults.MAXRECENT)

        files = settings.value("menubar/recentfiles",[])
        for f in files:
            if not os.path.exists(f):
                files.remove(f)
        settings.setValue("menubar/recentfiles",files)

        numShow = min(len(files),maxRecent)

        for i in range(numShow):
            text = QFileInfo(files[i]).fileName()
            self.acts[i].setText(text)
            self.acts[i].setData(files[i])
            self.acts[i].setVisible(True)

        for j in range(numShow,maxRecent):
            self.acts[j].setVisible(False)

        for i in range(maxRecent):
            self.addAction(self.acts[i])

        self.addSeparator()

        self.addAction(self.clearAct)
コード例 #8
0
ファイル: rpcUi.py プロジェクト: claudebideau/rpclib
class MainWindow(QtGui.QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("supervisor Interface")
        self.__mutex__ = QtCore.QMutex()

        self.__log__()
        self.__setting__()
        self.createActions()
        self.createMenus()
        self.__rpc__ = None
        self.centralWidget = CentralWidget(None,
                                           (self.settings, self.__mutex__))

        self.statusBar().showMessage("Ready")

    def __setting__(self):
        print "get setting"
        self.settings = QSettings(QSettings.IniFormat, QSettings.SystemScope,
                                  '__SUPERVISOR', '__settings')
        self.settings.setFallbacksEnabled(
            False)  # File only, not registry or or.

        self.__mutex__.lock()
        self.settings.beginGroup("Main")
        self.resize(self.settings.value("size", QtCore.QSize(1024, 850)))
        self.move(self.settings.value("pos", QtCore.QPoint(50, 50)))
        self.ip = self.settings.value("ip", r'172.25.195.58')
        print "previous IP=", self.ip

        self.settings.endGroup()
        self.__mutex__.unlock()

    def __log__(self):
        self.windowlog = {}

    def rpc(self):
        # Try to connect to a board
        print self.ip
        text, ok = QtGui.QInputDialog.getText(self, self.tr("Board IP"),
                                              self.tr("IP address:"),
                                              QtGui.QLineEdit.Normal, self.ip)

        if ok and not (len(text) == 0):
            try:
                self.__rpc__ = xmlrpclib.ServerProxy("http://%s:8000" %
                                                     str(text))
                self.statusBar().showMessage("Connected...")
                self.centralWidget.setrpc(self.__rpc__)
                self.__get_level__()
                self.setCentralWidget(self.centralWidget)
                self.ip = str(text)
            except Exception, e:
                self.statusBar().showMessage("Failed to connect to %s" % text)
                sys.stderr.write(str(e))
                traceback.print_exc(file=sys.stderr)
                pass

        return
コード例 #9
0
ファイル: main.py プロジェクト: jlehtoma/MaeBird
    def __init__(self, parent=None):
        super(MaeBird, self).__init__(parent)
        
        self.models = ModelFactory()

        self.table = None
        self.languages = {'perimary': 'Fin', 'secondary': 'Eng', 
                         'tertiary': 'Swe'}
        
        self.dbtype = __DB__
        self.dbfile = None
        self.db = None
        
        self.matches = []
        self.currentsearchitem = 0
        
        self.fullscreen = False
        self.setupUi(self)
        
        self.setWindowTitle(__APPNAME__ + ' ' + __VERSION__)
        
        # TODO: loading settings should be moved to a separate method
        settings = QSettings()
        
        # Set up logging
        loggingdir = settings.value("Logging/loggingDir")
        if loggingdir is None:
            loggingdir = __USER_DATA_DIR__
        self.logger = Logger('root', loggingdir=loggingdir)
        if settings.value("Settings/debugging"):
            self.logger.debugging = int(settings.value("Settings/debugging"))
            self.logger.debug('Logging initialized')
        
        # Try to load previous session
        if settings.value("Settings/saveSettings"):
            self.saveSettings = int(settings.value("Settings/saveSettings"))
        else:
            self.saveSettings = 1
                      
        if self.saveSettings:
            QTimer.singleShot(0, self.load_initial_data)
            #QTimer.singleShot(0, self.load_initial_model)
        
        self.header = self.tableView.horizontalHeader()
        self.header.sectionDoubleClicked.connect(self.sort_table)
        
        self.search.textEdited.connect(self.update_ui)
        self.search.setFocus()
        self.searchNextButton.clicked.connect(self.update_ui)
        self.searchPrevButton.clicked.connect(self.update_ui)
        
        self.tableView.pressed.connect(self.update_ui)
        
        self.tableView.doubleClicked.connect(
                    lambda: self.handle_observation(ObservationDialog.SHOW))
        self.addButton.clicked.connect(
                    lambda: self.handle_observation(ObservationDialog.ADD))
        self.deleteButton.clicked.connect(
                    lambda: self.handle_observation(ObservationDialog.DELETE))
コード例 #10
0
ファイル: SpecificOutput.py プロジェクト: ra2003/xindex
    def createWidgets(self):
        settings = QSettings()

        self.txtGroupBox = QGroupBox("Plain Text Format (.txt)")
        self.indentLabel = QLabel("&Indent")
        self.indentComboBox = QComboBox()
        self.indentLabel.setBuddy(self.indentComboBox)
        oldIndent = IndentKind.TAB
        oldIndent = self.config.get(Gconf.Key.Indent, oldIndent)
        index = -1
        for i, indent in enumerate(IndentKind):
            text = indent.name.replace("_", " ").title()
            self.indentComboBox.addItem(text, indent.value)
            if indent is oldIndent:
                index = i
        self.indentComboBox.setCurrentIndex(index)
        self.form.tooltips.append((self.indentComboBox, """\
<p><b>Indent</b></p>
<p>The indentation to use when outputting an indented-style index in
plain text format for each level of indentation.</p>"""))

        self.rtfGroupBox = QGroupBox("Rich Text Format (.rtf)")
        self.rtfIndentLabel = QLabel("I&ndent")
        self.rtfIndentComboBox = QComboBox()
        self.rtfIndentLabel.setBuddy(self.rtfIndentComboBox)
        oldIndent = IndentKind(int(settings.value(Gopt.Key.IndentRTF,
                                                  Gopt.Default.IndentRTF)))
        index = -1
        for i, indent in enumerate(IndentKind):
            text = ("Indent" if i == 0 else
                    indent.name.replace("_", " ").title())
            self.rtfIndentComboBox.addItem(text, indent.value)
            if indent is oldIndent:
                index = i
        self.rtfIndentComboBox.setCurrentIndex(index)
        self.form.tooltips.append((self.rtfIndentComboBox, """\
<p><b>Indent</b></p>
<p>The indentation to use when outputting an indented-style index in
rich text format for each level of indentation.</p>"""))

        self.pdfGroupBox = QGroupBox("Portable Document Format (.pdf)")
        self.paperSizeLabel = QLabel("Paper Size")
        self.letterRadioButton = QRadioButton("&Letter")
        self.a4RadioButton = QRadioButton("&A4")
        size = PaperSizeKind(int(settings.value(Gopt.Key.PaperSize,
                                                Gopt.Default.PaperSize)))
        if size is PaperSizeKind.LETTER:
            self.letterRadioButton.setChecked(True)
        else:
            self.a4RadioButton.setChecked(True)
        self.form.tooltips.append((self.letterRadioButton, """\
<p><b>Paper Size, Letter</b></p>
<p>If checked, when outputting a PDF of the index, US Letter
8.5"x11"-sized pages will be used.</p>"""))
        self.form.tooltips.append((self.a4RadioButton, """\
<p><b>Paper Size, A4</b></p>
<p>If checked, when outputting a PDF of the index, European A4-sized
pages will be used.</p>"""))
コード例 #11
0
ファイル: Window.py プロジェクト: ra2003/xindex
 def _getLanguageAndRules(self):
     settings = QSettings()
     language = LanguageKind(
         settings.value(Gopt.Key.Language, Gopt.Default.Language))
     sortAsRules = settings.value(Gopt.Key.SortAsRules,
                                  Gopt.Default.SortAsRules)
     pageRangeRules = settings.value(Gopt.Key.PageRangeRules,
                                     Gopt.Default.PageRangeRules)
     return language, sortAsRules, pageRangeRules
コード例 #12
0
    def __init__(self, parent=None):
        super(SettingsDialog, self).__init__(parent)

        self.setWindowTitle("Settings")

        main_layout = QVBoxLayout()

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        settings = QSettings()

        db_group = QGroupBox("Database")
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("File"), 0, 0)
        text = settings.value('DB/File')
        self.file = QLineEdit(text)
        self.file.setText(text)
        grid_layout.addWidget(self.file, 0, 1)
        browse = QPushButton("Browse")
        browse.clicked.connect(self.browse)
        grid_layout.addWidget(browse, 0, 2)
        db_group.setLayout(grid_layout)
        main_layout.addWidget(db_group)

        ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000  ")

        smtp_group = QGroupBox("SMTP")
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("Server"), 0, 0)
        text = settings.value('SMTP/Server')
        self.smtp_server = QLineEdit(text)
        self.smtp_server.setText(text)
        grid_layout.addWidget(self.smtp_server, 0, 1)
        smtp_group.setLayout(grid_layout)
        main_layout.addWidget(smtp_group)

        self.http_proxy = QGroupBox("HTTP Proxy")
        self.http_proxy.setCheckable(True)
        self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled')))
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("Server"), 0, 0)
        self.http_proxy_ip = QLineEdit()
        self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP'))
        self.http_proxy_ip.setMinimumWidth(ip_width)
        grid_layout.addWidget(self.http_proxy_ip, 0, 1)
        grid_layout.setColumnStretch(0, 1)
        self.http_proxy.setLayout(grid_layout)
        main_layout.addWidget(self.http_proxy)

        main_layout.addWidget(buttonBox)
        self.setLayout(main_layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
コード例 #13
0
ファイル: retriever.py プロジェクト: Jonney/Khweeteur
    def run(self):
        settings = QSettings('Khertan Software', 'Khweeteur')
        statuses = []

        logging.debug("Thread for '%s' running" % self.call)
        try:
            since = settings.value(self.account.token_key + '_' + self.call)

            logging.debug('%s running' % self.call)
            if self.call == 'HomeTimeline':
                statuses = self.account.api.GetHomeTimeline(since_id=since)
            elif self.call == 'Mentions':
                statuses = self.account.api.GetMentions(since_id=since)
            elif self.call == 'DMs':
                statuses = self.account.api.GetDirectMessages(since_id=since)
            elif self.call.startswith('Search:'):
                statuses = self.account.api.GetSearch(since_id=since,
                        term=self.call.split(':', 1)[1])
            elif self.call == 'RetrieveLists':
                # Get the list subscriptions

                lists = self.account.api.GetSubscriptions(
                    user=self.account.me_user)
                settings.beginWriteArray('lists')
                for (index, list_instance) in enumerate(lists):
                    settings.setArrayIndex(index)
                    settings.setValue('id', list_instance.id)
                    settings.setValue('user', list_instance.user.screen_name)
                    settings.setValue('name', list_instance.name)
                settings.endArray()

                # Get the status of list

                settings.sync()
            elif self.call.startswith('List:'):
                user, id = self.call.split(':', 2)[1:]
                statuses = self.account.api.GetListStatuses(
                    user=user, id=id, since_id=since)

            #Near GPS
            elif self.call.startswith('Near:'):
                geocode = self.call.split(':', 2)[1:] + ['1km']
                logging.debug('geocode=(%s)', str(geocode))
                statuses = self.account.api.GetSearch(
                    since_id=since, term='', geocode=geocode)
            else:
                logging.error('Unknown call: %s' % (self.call, ))

            success = True
        except Exception, err:
            success = False
            logging.debug('Retriever %s: %s' % (self.call, str(err)))
            if settings.value('ShowInfos') == '2':
                self.error.emit('Khweeteur Error : %s' % str(err))
コード例 #14
0
ファイル: settings.py プロジェクト: LS80/FFL
    def __init__(self, parent=None):
        super(SettingsDialog, self).__init__(parent)

        self.setWindowTitle("Settings")
        
        main_layout = QVBoxLayout()
        
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
        
        settings = QSettings()
        
        db_group = QGroupBox("Database")
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("File"),0,0)
        text = settings.value('DB/File')
        self.file = QLineEdit(text)
        self.file.setText(text)
        grid_layout.addWidget(self.file,0,1)
        browse = QPushButton("Browse")
        browse.clicked.connect(self.browse)
        grid_layout.addWidget(browse,0,2)
        db_group.setLayout(grid_layout)
        main_layout.addWidget(db_group)
        
        ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000  ")
    
        smtp_group = QGroupBox("SMTP")
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("Server"),0,0)
        text = settings.value('SMTP/Server')
        self.smtp_server = QLineEdit(text)
        self.smtp_server.setText(text)
        grid_layout.addWidget(self.smtp_server,0,1)
        smtp_group.setLayout(grid_layout)
        main_layout.addWidget(smtp_group)

        self.http_proxy = QGroupBox("HTTP Proxy")
        self.http_proxy.setCheckable(True)
        self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled')))
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("Server"),0,0)
        self.http_proxy_ip = QLineEdit()
        self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP'))
        self.http_proxy_ip.setMinimumWidth(ip_width)
        grid_layout.addWidget(self.http_proxy_ip,0,1)
        grid_layout.setColumnStretch(0,1)
        self.http_proxy.setLayout(grid_layout)
        main_layout.addWidget(self.http_proxy)
        
        main_layout.addWidget(buttonBox)
        self.setLayout(main_layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
コード例 #15
0
    def show_from_geometry_settings(self):
        print('MainWindow.show_from_geometry_settings')

        # TODO LH What if screen resolution, desktop config change or roaming
        # profile means that restored state is outside desktop?
        s = QSettings()

        self.restoreGeometry(s.value("mainwindow/geometry", self.saveGeometry()))
        if not (self.isMaximized() or self.isFullScreen()):
            self.move(s.value("mainwindow/pos", self.pos()))
            self.resize(s.value("mainwindow/size", self.size()))
        self.show()
コード例 #16
0
ファイル: mainwindow.py プロジェクト: Vavius/moai-ide
    def readSettings(self):
        settings = QSettings()

        self.restoreGeometry(settings.value("main/geometry"))
        self.restoreState(settings.value("main/windowState"))
        
        self.environmentDock.readSettings()
        self.debugDock.readSettings()
        if not self.runningFile:
            self.runningFile = settings.value("main/currentFile")
            print(self.runningFile)
            QtCore.QTimer.singleShot(0, self, QtCore.SLOT("reloadMoai()"))
コード例 #17
0
ファイル: barcode_settings.py プロジェクト: edwbaker/inselect
def current_settings():
    """Returns a dict of the current settings:
    {
        "engine": one of ('libdmtx', 'zbar', 'inlite'),
        "inlite-format": one of ('1d', 'datamatrix', 'pdf417', 'qrcode'),
    }
    """
    s = QSettings()
    return {
        'engine': s.value('barcode/engine', 'libdmtx'),
        'inlite-format': s.value('barcode/inlite-format', 'datamatrix')
    }
コード例 #18
0
    def show_from_geometry_settings(self):
        print('MainWindow.show_from_geometry_settings')

        # TODO LH What if screen resolution, desktop config change or roaming
        # profile means that restored state is outside desktop?
        s = QSettings()

        self.restoreGeometry(
            s.value("mainwindow/geometry", self.saveGeometry()))
        if not (self.isMaximized() or self.isFullScreen()):
            self.move(s.value("mainwindow/pos", self.pos()))
            self.resize(s.value("mainwindow/size", self.size()))
        self.show()
コード例 #19
0
ファイル: Config.py プロジェクト: PySide/transmission-client
class ServerConfig(object):
    CONFIG_HOST_KEY = "server/host"
    CONFIG_PORT_KEY = "server/port"
    CONFIG_USER_KEY = "server/user"
    CONFGI_PASSWORD_KEY = "server/password"

    def __init__(self):
        self._config = QSettings()
        self._host = self._config.value(ServerConfig.CONFIG_HOST_KEY, '')
        self._port = self._config.value(ServerConfig.CONFIG_PORT_KEY, 0)
        self._user = self._config.value(ServerConfig.CONFIG_USER_KEY, '')
        self._password = self._config.value(ServerConfig.CONFGI_PASSWORD_KEY, '')

    def commit(self):
        self._config.setValue(ServerConfig.CONFIG_HOST_KEY, self._host)
        self._config.setValue(ServerConfig.CONFIG_PORT_KEY, self._port)
        self._config.setValue(ServerConfig.CONFIG_USER_KEY, self._user)
        self._config.setValue(ServerConfig.CONFGI_PASSWORD_KEY, self._password)
        self._config.sync()

    def isValid(self):
        return len(self._host) > 0

    def getHost(self):
        return self._host

    def setHost(self, host):
        self._host = host

    def getPort(self):
        return self._port

    def setPort(self, port):
        self._port = port

    def getUser(self):
        return self._user

    def setUser(self, user):
        self._user = user

    def getPassword(self):
        return self._password

    def setPassword(self, password):
        self._password = password

    host = property(getHost, setHost)
    port = property(getPort, setPort)
    user = property(getUser, setUser)
    password = property(getPassword, setPassword)
コード例 #20
0
ファイル: preferences.py プロジェクト: elmamyra/kbremap
 def __init__(self, parent, mItem=None):
     super(PreferenceDialog, self).__init__(parent)
     self.setWindowTitle(self.tr("Preferences"))
     layout = QVBoxLayout(self)
     modelLayout = QHBoxLayout()
     settings = QSettings()
     #startup
     startupCheck = QCheckBox(self.tr("Launch at startup"))
     autoStart = os.path.exists(os.path.join(util.configDir, 'autostart', 'kpremap-server.desktop'))
     startupCheck.setChecked(autoStart)
     startupCheck.stateChanged.connect(self.slotAutoStart)
     #auto update
     updateCheck = QCheckBox(self.tr("Automatically update the server"))
     autoUpdate = util.str2bool(settings.value('autoUpdate', 'true'))
     updateCheck.setChecked(autoUpdate)
     updateCheck.stateChanged.connect(self.slotAutoUpdate)
     #notiny
     notifyCheck = QCheckBox(self.tr("Show notification"))
     notify = parent.mapping().notify()
     notifyCheck.setChecked(notify)
     notifyCheck.stateChanged.connect(self.slotNotify)
     #model
     self.comboModel = QComboBox()
     modList = ((self.tr('Generic 101'), 'generic_101'), 
                (self.tr('Generic 102'), 'generic_102'),
                (self.tr('Generic 104'), 'generic_104'),
                (self.tr('Generic 105'), 'generic_105'),
                ('TypeMatrix', 'typeMatrix'),
                )
     for title, name in modList:
         self.comboModel.addItem(title, name)
     
     
     currentModel = settings.value('keyboardModel', 'generic_105')
     index = self.comboModel.findData(currentModel)
     self.comboModel.setCurrentIndex(index)
     self.comboModel.currentIndexChanged.connect(self.slotModel)
     
     modelLayout.addWidget(QLabel(self.tr("keyboard model:")))
     modelLayout.addWidget(self.comboModel)
     
     buttonBox = QDialogButtonBox(QDialogButtonBox.Close,
                                  rejected=self.reject)
     
     
     layout.addWidget(startupCheck)
     layout.addWidget(updateCheck)
     layout.addWidget(notifyCheck)
     layout.addLayout(modelLayout)
     layout.addWidget(Separator())
     layout.addWidget(buttonBox)
コード例 #21
0
ファイル: settings.py プロジェクト: babyge/ebbbe
class Settings(object):
    def __init__(self):
        self.dirFile = '.'
        self.frequency = 30.

        self._settings = QSettings('Ear to Ear Oak', 'ebbbe')

        self.dirFile = self._settings.value('dirFile', self.dirFile)
        self.frequency = float(
            self._settings.value('frequency', self.frequency))

    def save(self):
        self._settings.setValue('dirFile', self.dirFile)
        self._settings.setValue('frequency', self.frequency)
コード例 #22
0
    def mruLoadList(self):
        """
		Loads the list of MRU files from the pplication settings file.
		"""
        self.mru_list = list()
        qs = QSettings()

        count = qs.beginReadArray("mru")
        for i in range(count):
            qs.setArrayIndex(i)
            path = qs.value("path")
            description = qs.value("description")
            if os.path.exists(path):
                self.mru_list.append((path, description))
        qs.endArray()
コード例 #23
0
ファイル: indicator.py プロジェクト: guofengstc/everpad
class PadApp(QApplication):
    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)
        self.settings = QSettings('everpad', 'everpad-pad')
        self.translator = QTranslator()
        if not self.translator.load('../../i18n/%s' % QLocale.system().name()):
            self.translator.load('/usr/share/everpad/i18n/%s' %
                                 QLocale.system().name())
        self.installTranslator(self.translator)
        self.indicator = Indicator(self)
        self.update_icon()
        self.indicator.show()

    def update_icon(self):
        if int(self.settings.value('black-icon', 0)):
            self.icon = QIcon.fromTheme('everpad-black',
                                        QIcon('../../data/everpad-black.png'))
        else:
            self.icon = QIcon.fromTheme('everpad-mono',
                                        QIcon('../../data/everpad-mono.png'))
        self.indicator.setIcon(self.icon)

    def send_notify(self, text):
        self.indicator.showMessage('Everpad', text,
                                   QSystemTrayIcon.Information)

    def on_sync_state_changed(self, state):
        self.launcher.update({
            'progress':
            float(state + 1) / len(SYNC_STATES),
            'progress-visible':
            state not in (SYNC_STATE_START, SYNC_STATE_FINISH),
        })
コード例 #24
0
 def editingFinishedHandler(self):
     settings = QSettings()
     old = settings.value("computation/reduce",QtReduceDefaults.REDUCE)
     new = self.reduceBinary.text()
     if old == new:
         return
     self.reduceBinary.blockSignals(True)
     tit = "Change Binary?"
     txt = self.tr("Do you really want to change this setting?")
     itxt = self.tr("If yes, then the binary ")
     itxt += '"' + new + '" '
     itxt += self.tr("will be used at the next restart.")
     mbox = QMessageBox(self)
     mbox.setIcon(QMessageBox.Question)
     mbox.setWindowModality(Qt.WindowModal)
     mbox.setWindowTitle(tit)
     mbox.setText(txt)
     mbox.setInformativeText(itxt)
     mbox.setStandardButtons(QMessageBox.Yes|QMessageBox.No)
     button = mbox.exec_()
     if button == QMessageBox.Yes:
         settings.setValue("computation/reduce",new)
     else:
         self.reduceBinary.setText(old)
     self.reduceBinary.blockSignals(False)
コード例 #25
0
ファイル: indicator.py プロジェクト: guofengstc/everpad
class PadApp(QApplication):
    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)
        self.settings = QSettings('everpad', 'everpad-pad')
        self.translator = QTranslator()
        if not self.translator.load('../../i18n/%s' % QLocale.system().name()):
            self.translator.load('/usr/share/everpad/i18n/%s' % QLocale.system().name())
        self.installTranslator(self.translator)
        self.indicator = Indicator(self)
        self.update_icon()
        self.indicator.show()

    def update_icon(self):
        if int(self.settings.value('black-icon', 0)):
            self.icon = QIcon.fromTheme('everpad-black', QIcon('../../data/everpad-black.png'))
        else:
            self.icon = QIcon.fromTheme('everpad-mono', QIcon('../../data/everpad-mono.png'))
        self.indicator.setIcon(self.icon)

    def send_notify(self, text):
        self.indicator.showMessage('Everpad', text,
            QSystemTrayIcon.Information)

    def on_sync_state_changed(self, state):
        self.launcher.update({
            'progress': float(state + 1) / len(SYNC_STATES),
            'progress-visible': state not in (SYNC_STATE_START, SYNC_STATE_FINISH),
        })
コード例 #26
0
ファイル: command.py プロジェクト: dheller1/kowsim
 def Execute(self, filename=None):
    if filename is None:
       settings = QSettings("NoCompany", "KowArmyBuilder")
       preferredFolder = settings.value("preferred_folder")
       if preferredFolder is None: preferredFolder = ".."
       filename, _ = QtGui.QFileDialog.getOpenFileName(self._mdiArea, "Open army list", preferredFolder, "Army lists (*.lst);;All files (*.*)")
       if len(filename)==0: return
       else: settings.setValue("preferred_folder", os.path.dirname(filename))
    
    # check if the file is already open
    for wnd in self._mdiArea.subWindowList():
       if hasattr(wnd.widget(), '_lastFilename') and wnd.widget()._lastFilename == filename: # be sure not to check preview or other windows --- this is ugly. TODO: Better solution
          self._mdiArea.setActiveSubWindow(wnd)
          return
    
    alr = ArmyListReader(QtGui.qApp.DataManager)
    
    try: armylist, warnings = alr.LoadFromFile(filename)
    except IOError as e:
       QtGui.QMessageBox.critical(self._mdiArea, "Error loading %s" % filename, "We're sorry, the file could not be loaded.\nError message:\n  %s" % (e))
       return False
    except Exception as e:
       QtGui.QMessageBox.critical(self._mdiArea, "Error loading %s" % filename, "We're sorry, the file could not be loaded.\nAn unknown error occurred. Error message:\n  %s" % (e))
       return False
    
    if warnings != []:
       QtGui.QMessageBox.warning(self._mdiArea, "Warning", "File %s was successfully loaded, but there were warnings:\n" % os.path.basename(filename) + "\n".join(warnings))
       
    view = self._mdiArea.AddArmySubWindow(ArmyListModel(armylist))
    view.SetLastFilename(filename)
    QtGui.qApp.DataManager.AddRecentFile(filename)
    view.siRecentFilesChanged.emit()
    print view.ctrl._views
    return view
コード例 #27
0
ファイル: command.py プロジェクト: dheller1/kowsim
 def Execute(self):
    defaultName = self.alView._lastFilename if self.alView._lastFilename else "%s.lst" % self.alModel.data.CustomName()
    if (not self.alView._lastFilename) or self.saveAs:
       settings = QSettings("NoCompany", "KowArmyBuilder")
       preferredFolder = settings.value("preferred_folder")
       if preferredFolder is None: preferredFolder = ".."
       
       filename, _ = QtGui.QFileDialog.getSaveFileName(self.alView, "Save army list as", "%s" % (os.path.join(preferredFolder, defaultName)),
                                                    "Army lists (*.lst);;All files (*.*)")
       if filename == "": return
       else: self.alView._lastFilename = filename
       QtGui.qApp.DataManager.AddRecentFile(filename)
       settings.setValue("preferred_folder", os.path.dirname(filename))
       self.alView.siRecentFilesChanged.emit()
    else:
       filename = self.alView._lastFilename
    
    try:
       alw = ArmyListWriter(self.alModel.data)
       alw.SaveToFile(filename)
    except IOError as e:
       QtGui.QMessageBox.critical(self.alView, "Error while saving", "An error occurred while saving the army list:\n  %s" % e)
    else:
       self.alModel.modified = False
       self.hints = (ToggleModifiedHint(), )
コード例 #28
0
ファイル: Window.py プロジェクト: ra2003/xindex
 def initialize(self):
     self.setWindowTitle("{}".format(QApplication.applicationName()))
     self.state.updateDisplayFonts()
     self.filename = None
     if len(sys.argv) > 1:
         filename = sys.argv[1]
         if (filename.lower().endswith(EXTENSION)
                 and os.path.exists(filename)):
             self.filename = filename
     if self.filename is None:
         settings = QSettings()
         filename = settings.value(Gopt.Key.MainForm_Filename,
                                   Gopt.Default.MainForm_Filename)
         if (filename and filename.lower().endswith(EXTENSION)
                 and os.path.exists(filename)):
             self.filename = filename
     if self.filename is None:
         say("Click File→New or File→Open to create or open an index")
         self.updateWorkTime()
         self.state.updateUi()
     else:
         say("Opening {}".format(os.path.normpath(self.filename)))
         QTimer.singleShot(5, self.openXix)
     self.updateRecentFilesMenu()
     self.updateToolTips()
     Lib.maybe_register_filetype(self.debug)
コード例 #29
0
ファイル: debugdock.py プロジェクト: Vavius/moai-ide
    def readSettings(self):
        settings = QSettings()

        ui = self.ui
        for style in MOAIDebugDrawStyles:
            checkBox = getattr(ui, style)
            widthEdit = getattr(ui, style + "Width")
            colorBtn = getattr(ui, style + "Color")

            checkBox.setChecked ( bool(settings.value( "debug/" + style + 'DrawEnabled', False )) )
            widthEdit.setText ( str(settings.value( "debug/" + style + 'Width', '1' )) )
            colorBtn.setColor ( settings.value( "debug/" + style + 'Color', QColor(255, 255, 255, 255) ))

        ui.histogram.setChecked ( bool(settings.value( "debug/histogramEnabled", False )) )
        ui.allocLog.setChecked ( bool(settings.value( "debug/allocTrackingEnabled", False )) )
        ui.reportHistogram_btn.setEnabled( ui.histogram.isChecked() )
コード例 #30
0
ファイル: bug_829.py プロジェクト: renatofilho/PySide
 def testDictionary(self):
     s = QSettings(adjust_filename('bug_829.conf', __file__), QSettings.IniFormat)
     #Save value 
     s.setValue('x', {1: 'a'})
     s.sync()
     #Restore value
     self.assertEqual(s.value('x'), {1: 'a'})
コード例 #31
0
    def __loadGeometry(self):
        settings = QSettings("Intel_OTC", "obslightgui")
        propMap = {
            "mainWindow/geometry": self.__mainWindow.restoreGeometry,
            "mainWindow/state": self.__mainWindow.restoreState,
            "mainWindow/splitter2State":
            self.__mainWindow.splitter_2.restoreState,
            "mainWindow/splitter3State":
            self.__mainWindow.splitter_3.restoreState,
            "mainWindow/splitter4State":
            self.__mainWindow.splitter_4.restoreState,
            "mainWindow/splitter5State":
            self.__mainWindow.splitter_5.restoreState,
            "mainWindow/splitter6State":
            self.__mainWindow.splitter_6.restoreState,
            "mainWindow/splitterState":
            self.__mainWindow.splitter.restoreState,
            "mainWindow/splitterGeo":
            self.__mainWindow.splitter.restoreGeometry,
            "logWindow/geometry": self.__logManager.restoreGeometry
        }

        for propName, func in propMap.iteritems():
            prop = settings.value(propName)
            if prop is not None:
                func(prop)
コード例 #32
0
ファイル: EmptyCopy.py プロジェクト: ra2003/xindex
 def accept(self):
     settings = QSettings()
     language = LanguageKind(
         settings.value(Gopt.Key.Language, Gopt.Default.Language))
     if self.configCheckBox.isChecked():
         sortasrules = Gopt.Default.SortAsRules
         pagerangerules = Gopt.Default.PageRangeRules
     else:
         sortasrules = self.state.model.sortAsRules()
         pagerangerules = self.state.model.pageRangeRules()
     copyInfo = CopyInfo(self.state.model.filename,
                         self.filenameLabel.text(),
                         self.configCheckBox.isChecked(),
                         self.customMarkupCheckBox.isChecked(),
                         self.spellWordsCheckBox.isChecked(),
                         self.ignoredFirstWordsCheckBox.isChecked(),
                         self.autoReplaceCheckBox.isChecked(),
                         self.groupsCheckBox.isChecked(),
                         self.state.model.username, language, sortasrules,
                         pagerangerules)
     self.state.window.closeXix()
     self.state.model.copyEmpty(copyInfo)
     self.state.window.openXix(copyInfo.newname)
     self.state.entryPanel.clearForm()
     self.state.setMode(ModeKind.VIEW)
     super().accept()
コード例 #33
0
ファイル: editTeam.py プロジェクト: LS80/FFL
    def confirmSubs(self, playersIn, playersOut, datetime):
        week = gameinfo.weekNum(datetime) + 1
        date = gameinfo.weekToDate(week).date()

        html = render_to_string('subs_email.html', {'team': self.team,
                                                    'players_in': playersIn,
                                                    'players_out': playersOut,
                                                    'week': week,
                                                    'date': date}
                                )

        settings = QSettings()
        if settings.contains('SMTP/Server'):
            smtp_server = settings.value('SMTP/Server')
        else:
            smtp_server = None
        
        if not smtp_server:
            QMessageBox.critical(self, "Email Error", "Please add an SMTP server in settings.")
        else:
            email = HTMLEmail([self.team.email],
                              "*****@*****.**",
                              "Fantasy Football League",
                              bcc='*****@*****.**')
            email.sendMail("Sub Confirmation", html, smtp_server)
コード例 #34
0
    def _tryToFillPlayerPath(self, playerpath, playerpathlist):
        settings = QSettings("Syncplay", "PlayerList")
        settings.beginGroup("PlayerList")
        savedPlayers = settings.value("PlayerList", [])
        if(not isinstance(savedPlayers, list)):
            savedPlayers = []
        playerpathlist = list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist + savedPlayers)))
        settings.endGroup()
        foundpath = ""

        if playerpath != None and playerpath != "":
            if not os.path.isfile(playerpath):
                expandedpath = PlayerFactory().getExpandedPlayerPathByPath(playerpath)
                if expandedpath != None and os.path.isfile(expandedpath):
                    playerpath = expandedpath

            if os.path.isfile(playerpath):
                foundpath = playerpath
                self.executablepathCombobox.addItem(foundpath)

        for path in playerpathlist:
            if(os.path.isfile(path) and os.path.normcase(os.path.normpath(path)) != os.path.normcase(os.path.normpath(foundpath))):
                self.executablepathCombobox.addItem(path)
                if foundpath == "":
                    foundpath = path

        if foundpath != "":
            settings.beginGroup("PlayerList")
            playerpathlist.append(os.path.normcase(os.path.normpath(foundpath)))
            settings.setValue("PlayerList",  list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
            settings.endGroup()
        return(foundpath)
コード例 #35
0
ファイル: File.py プロジェクト: ra2003/xindex
 def printIndex(self):
     widget = QApplication.focusWidget()
     if self.state.printer is None:
         self.state.printer = QPrinter(QPrinter.HighResolution)
         self.state.printer.setColorMode(QPrinter.GrayScale)
         settings = QSettings()
         size = PaperSizeKind(
             int(settings.value(Gopt.Key.PaperSize,
                                Gopt.Default.PaperSize)))
         self.state.printer.setPaperSize(
             QPrinter.Letter if size is PaperSizeKind.LETTER else QPrinter.
             A4)
     with Lib.Qt.DisableUI(*self.window.widgets(), forModalDialog=True):
         form = QPrintDialog(self.state.printer, self.state.window)
         form.setWindowTitle("Print Index")
         if form.exec_():
             try:
                 with Lib.DisableUI(*self.window.widgets()):
                     config = self.state.model.configs().copy()
                     config.Filename = "print.$$$"
                     config.Printer = self.state.printer
                     Output.outputEntries(self.state.model, config,
                                          "Printing",
                                          self.window.reportProgress)
                 say("Printed")
             except Output.Error as err:
                 say("Failed to print: {}".format(err))
                 logging.error("printIndex failed: {}".format(err))
     Lib.restoreFocus(widget)
コード例 #36
0
ファイル: editTeam.py プロジェクト: ldonjibson/FFL
    def confirmSubs(self, playersIn, playersOut, datetime):
        week = gameinfo.weekNum(datetime) + 1
        date = gameinfo.weekToDate(week).date()

        html = render_to_string(
            'subs_email.html', {
                'team': self.team,
                'players_in': playersIn,
                'players_out': playersOut,
                'week': week,
                'date': date
            })

        settings = QSettings()
        if settings.contains('SMTP/Server'):
            smtp_server = settings.value('SMTP/Server')
        else:
            smtp_server = None

        if not smtp_server:
            QMessageBox.critical(self, "Email Error",
                                 "Please add an SMTP server in settings.")
        else:
            email = HTMLEmail([self.team.email],
                              "*****@*****.**",
                              "Fantasy Football League",
                              bcc='*****@*****.**')
            email.sendMail("Sub Confirmation", html, smtp_server)
コード例 #37
0
    def _tryToFillPlayerPath(self, playerpath, playerpathlist):
        settings = QSettings("Syncplay", "PlayerList")
        settings.beginGroup("PlayerList")
        savedPlayers = settings.value("PlayerList", [])
        if(not isinstance(savedPlayers, list)):
            savedPlayers = []
        playerpathlist = list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist + savedPlayers)))
        settings.endGroup()
        foundpath = ""

        if playerpath != None and playerpath != "":
            if not os.path.isfile(playerpath):
                expandedpath = PlayerFactory().getExpandedPlayerPathByPath(playerpath)
                if expandedpath != None and os.path.isfile(expandedpath):
                    playerpath = expandedpath

            if os.path.isfile(playerpath):
                foundpath = playerpath
                self.executablepathCombobox.addItem(foundpath)

        for path in playerpathlist:
            if(os.path.isfile(path) and os.path.normcase(os.path.normpath(path)) != os.path.normcase(os.path.normpath(foundpath))):
                self.executablepathCombobox.addItem(path)
                if foundpath == "":
                    foundpath = path

        if foundpath != "":
            settings.beginGroup("PlayerList")
            playerpathlist.append(os.path.normcase(os.path.normpath(foundpath)))
            settings.setValue("PlayerList", list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
            settings.endGroup()
        return(foundpath)
コード例 #38
0
class PadApp(QApplication):
    data_changed = Signal()

    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)
        self.settings = QSettings('everpad', 'everpad-pad')
        locale = QLocale.system().name()
        self.qtTranslator = QTranslator()
        self.qtTranslator.load(
            "qt_" + locale,
            QLibraryInfo.location(QLibraryInfo.TranslationsPath))
        self.installTranslator(self.qtTranslator)
        self.appTranslator = QTranslator()
        if not self.appTranslator.load(
                locale, os.path.join(os.path.dirname(__file__), '../../i18n')):
            self.appTranslator.load(locale,
                                    resource_filename('share/everpad/i18n'))
        # This application string can be localized to 'RTL' to switch the application layout
        # direction. See for example i18n/ar_EG.ts
        QT_TRANSLATE_NOOP('QApplication', 'QT_LAYOUT_DIRECTION')
        self.installTranslator(self.appTranslator)
        QNetworkProxyFactory.setUseSystemConfiguration(True)
        self.indicator = Indicator()
        self.update_icon()
        self.indicator.show()

    def update_icon(self):
        is_black = int(self.settings.value('black-icon', 0))
        self.icon = get_tray_icon(is_black)
        self.indicator.setIcon(self.icon)

    def send_notify(self, text):
        self.indicator.showMessage('Everpad', text,
                                   QSystemTrayIcon.Information)

    def on_sync_state_changed(self, state):
        if int(self.settings.value('launcher-progress', 1)):
            self.launcher.update({
                'progress':
                float(state + 1) / len(SYNC_STATES),
                'progress-visible':
                state not in (SYNC_STATE_START, SYNC_STATE_FINISH),
            })

    def on_data_changed(self):
        """Note, notebook or tag changed"""
        self.data_changed.emit()
コード例 #39
0
ファイル: ctSESAM.py プロジェクト: rbuchli/ctSESAM-pyside
 def __init__(self):
     super(MainWindow, self).__init__()
     self.nam = QNetworkAccessManager()
     self.setWindowIcon(QIcon(os.path.join('icons', 'Logo_rendered_edited.png')))
     layout = QBoxLayout(QBoxLayout.TopToBottom)
     layout.setContentsMargins(0, 0, 0, 0)
     self.preference_manager = PreferenceManager()
     self.kgk_manager = KgkManager()
     self.kgk_manager.set_preference_manager(self.preference_manager)
     self.settings_manager = PasswordSettingsManager(self.preference_manager)
     self.setting_dirty = True
     # Header bar
     header_bar = QFrame()
     header_bar.setStyleSheet(
         "QWidget { background: rgb(40, 40, 40); } " +
         "QToolButton { background: rgb(40, 40, 40); }" +
         "QToolTip { color: rgb(255, 255, 255); background-color: rgb(20, 20, 20); " +
         "border: 1px solid white; }")
     header_bar.setAutoFillBackground(True)
     header_bar.setFixedHeight(45)
     header_bar_layout = QBoxLayout(QBoxLayout.LeftToRight)
     header_bar_layout.addStretch()
     header_bar.setLayout(header_bar_layout)
     layout.addWidget(header_bar)
     self.create_header_bar(header_bar_layout)
     # Widget area
     main_area = QFrame()
     main_layout = QBoxLayout(QBoxLayout.TopToBottom)
     main_area.setLayout(main_layout)
     layout.addWidget(main_area)
     self.create_main_area(main_layout)
     # Window layout
     layout.addStretch()
     main_layout.addStretch()
     self.setLayout(layout)
     settings = QSettings()
     size = settings.value("MainWindow/size")
     if not size:
         size = QSize(350, 450)
     self.resize(size)
     position = settings.value("MainWindow/pos")
     if not position:
         position = QPoint(0, 24)
     self.move(position)
     self.setWindowTitle("c't SESAM")
     self.master_password_edit.setFocus()
     self.show()
コード例 #40
0
ファイル: LiquidEmerald.py プロジェクト: Ingener74/Olive-Moon
class Window(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setWindowTitle('Liquid Emerald')
        self.setWindowIcon(QIcon(QPixmap('emerald.png')))

        self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, 'VenusGames', 'LiquidEmerald')
        self.restoreGeometry(self.settings.value(self.__class__.__name__))

        connection1 = Connection()

        self.block = Block(columns=[
            Column(width=30),
            Column(blocks=[
                Block(left_pins=[
                    Pin(left_connections=[
                        connection1.end
                    ]),
                    Pin()
                ]),
                Block(columns=[
                    Column(blocks=[
                        Block(columns=[
                            Column(width=30),
                            Column(blocks=[
                                Block(size=QSize(40, 20)),
                                Block()
                            ])
                        ], left_pins=[
                            Pin(),
                            Pin()
                        ], right_pins=[
                            Pin()
                        ]),
                        Block()
                    ]),
                    Column()
                ], right_pins=[
                    Pin()
                ])
            ]),
            Column(blocks=[
                Block(size=QSize(30, 30))
            ])
        ], left_pins=[
            Pin(right_connections=[
                connection1.start
            ])
        ])

    def paintEvent(self, event):
        self.block.paint(QPainter(self), QPoint(5, 5))

    def closeEvent(self, event):
        self.settings.setValue(self.__class__.__name__, self.saveGeometry())

    def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close()
コード例 #41
0
ファイル: qrmainwindow.py プロジェクト: webushka/reduce
    def addFile(self,fullPath):
        fileName = fullPath
        settings = QSettings()
        files = settings.value("menubar/recentfiles",[])

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

        files.insert(0,fileName)

        maxRecent = settings.value("menubar/maxrecent",
                                   QtReduceDefaults.MAXRECENT)
        del files[maxRecent:]

        settings.setValue("menubar/recentfiles",files)
コード例 #42
0
    def __init__(self,parent=None):
        super(QtReducePreferencesToolBar,self).__init__(parent)

        settings = QSettings()

        toolBarGroup = QGroupBox(self.tr("Toolbar"))

        self.iconSetCombo = QtReduceComboBox()
        iDbKeys = QtReduceIconSets().db.keys()
        iDbKeys.sort()
        self.iconSetCombo.addItems(iDbKeys)

        settings.setValue("toolbar/iconset","Oxygen") # Hack

        traceLogger.debug("toolbar/iconset=%s" % settings.value("toolbar/iconset"))

        self.iconSetCombo.setCurrentIndex(
            self.iconSetCombo.findText(
                settings.value("toolbar/iconset",QtReduceDefaults.ICONSET)))

        self.iconSizeCombo = QtReduceIconSizeComboBox()
        self.iconSizeCombo.addItems(["16","22","32"])
        self.iconSizeCombo.setCurrentIndex(
            self.iconSizeCombo.findText(
                str(settings.value("toolbar/iconsize",
                                   QtReduceDefaults.ICONSIZE))))

        self.showCombo = QtReduceComboBox()
        self.showCombo.addItems([self.tr("Symbol and Text"),
                                 self.tr("Only Symbol"),
                                 self.tr("Only Text")])
        self.showCombo.setCurrentIndex(self.showCombo.findText(
            settings.value("toolbar/buttonstyle",
                           self.tr(QtReduceDefaults.BUTTONSTYLE))))

        toolBarLayout = QFormLayout()
#        toolBarLayout.addRow(self.tr("Symbol Set"),self.iconSetCombo)
        toolBarLayout.addRow(self.tr("Symbol Size"),self.iconSizeCombo)
        toolBarLayout.addRow(self.tr("Show"),self.showCombo)

        toolBarGroup.setLayout(toolBarLayout)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(toolBarGroup)

        self.setLayout(mainLayout)
コード例 #43
0
ファイル: main.py プロジェクト: jlehtoma/MaeBird
 def load_initial_data(self):
     settings = QSettings()
     dbfile = unicode(settings.value("Database/LastDb"))
     modelname = unicode(settings.value("Database/DefaultModel"))
     if dbfile and QFile.exists(dbfile):
         self.load_db(dbfile, modelname=modelname)
         self.logger.debug("Loaded database %s with model %s" % (dbfile,
                                                                  modelname))
     
     if settings.value("Database/visibleFields"):
         visible_fields = [item for item in settings.value("Database/visibleFields")]
     
         # FIXME: in absence of QVariant, deal with values
         visible_fields = [False if item == 'false' else True for item in visible_fields]
         if not all(visible_fields):
             self.logger.debug("Hiding fields %s" % visible_fields)
         self.show_fields(visible_fields)
コード例 #44
0
 def getMoreState(self):
     settings = QSettings("Syncplay", "MoreSettings")
     settings.beginGroup("MoreSettings")
     morestate = unicode.lower(unicode(settings.value("ShowMoreSettings", "false")))
     settings.endGroup()
     if morestate == "true":
         return(True)
     else:
         return(False)
コード例 #45
0
ファイル: _Window.py プロジェクト: ra2003/xindex
 def menuHovered(self, action):
     settings = QSettings()
     if bool(
             int(
                 settings.value(Gopt.Key.ShowMenuToolTips,
                                Gopt.Default.ShowMenuToolTips))):
         tip = action.toolTip()
         if tip:
             QToolTip.showText(QCursor.pos(), tip, self)
コード例 #46
0
ファイル: load_data.py プロジェクト: dheller1/kowsim
    def AddRecentFile(self, filename):
        settings = QSettings("NoCompany", "KowArmyBuilder")
        recent = deque()

        numRecent = int(settings.value("Recent/NumRecent"))
        for i in range(numRecent):
            val = settings.value("Recent/%d" % (i + 1))
            if not val: break
            recent.append(val)

        if filename in recent: recent.remove(filename)
        elif len(recent) == numRecent: recent.pop()
        recent.appendleft(filename)

        i = 0
        for filename in recent:
            settings.setValue("Recent/%d" % (i + 1), filename)
            i += 1
コード例 #47
0
 def getLastPrestratumImportDir(self):
   settings = QSettings()
   settings.beginGroup("DefaultDirs")
   dir = str(settings.value("PrestratumImportDir"))
   settings.endGroup()
   if dir:
     return dir
   else:
     return ""
コード例 #48
0
 def getMoreState(self):
     settings = QSettings("Syncplay", "MoreSettings")
     settings.beginGroup("MoreSettings")
     morestate = unicode.lower(unicode(settings.value("ShowMoreSettings", "false")))
     settings.endGroup()
     if morestate == "true":
         return(True)
     else:
         return(False)
コード例 #49
0
def QloadParameter(paramName, quiet=False):
    from PySide.QtCore import QSettings
    settings = QSettings("TCfA", "CPEDS")
    paramValue = settings.value(paramName)

    if quiet == False:
        print('loading Qparameter: %s' % paramName)
        print('    parameter value: ', paramValue)
    return paramValue
コード例 #50
0
ファイル: list_model.py プロジェクト: Jonney/Khweeteur
    def load(self, call, limit=None):
        """
        Load a stream.

        call is the stream to load (see
        retriever.py:KhweeteurRefreshWorker for a description of the
        possible values).

        limit is the maximum number of messages to show.  If the
        number of messages exceeds limit, then selects the newest
        messages (in terms of creation time, not download time).

        Returns whether the load loaded a new data set (True) or was
        just a reload (False).
        """
        self.now = time.time()

        # print "model.load(%s -> %s)" % (self.call, call)

        # new_message_horizon is the point in time that separates read
        # messages from new messages.  The messages' creation time is
        # used.
        settings = QSettings('Khertan Software', 'Khweeteur')
        if self.call != call:
            # It's not a reload.  Save the setting for the old stream
            # and load the setting for the new one.
            reloading = True

            self.save_config()

            try:
                self.new_message_horizon = int(
                    settings.value(call + '-new-message-horizon', 0))
            except (ValueError, TypeError) :
                self.new_message_horizon = self.now
                
            # There might be some useful avatars, but figuring out
            # which they are requires loading all of the status
            # updates.
            self.avatars = {}
        else:
            reloading = False

        self.nothing_really_loaded = False

        self.call = call

        self.avatar_path = os.path.join(os.path.expanduser('~'), '.khweeteur',
                                       'avatars')

        folder = self.getCacheFolder()
        try:
            self.uids = os.listdir(folder)
        except (IOError, EOFError, OSError), e:
            if e.errno != errno.ENOENT:
                logging.exception('listdir(%s): %s' % (folder, str(e)))
            self.uids = []
コード例 #51
0
ファイル: bug_829.py プロジェクト: pymor/pyside_wheelbuilder
    def testDictionary(self):
        confFile = tempfile.NamedTemporaryFile(delete=False)
        s = QSettings(confFile.name, QSettings.IniFormat)
        # Save value
        s.setValue('x', {1: 'a'})
        s.sync()
        del s

        # Restore value
        s = QSettings(confFile.name, QSettings.IniFormat)
        self.assertEqual(s.value('x'), {1: 'a'})
コード例 #52
0
    def _readAndApplyWindowAttributeSettings(self):
        '''
    Read window attributes from settings,
    using current attributes as defaults (if settings not exist.)
    
    Called at QMainWindow initialization, before show().
    '''
        qsettings = QSettings()

        qsettings.beginGroup("mainWindow")

        # No need for toPoint, etc. : PySide converts types
        self.restoreGeometry(qsettings.value("geometry", self.saveGeometry()))
        self.restoreState(qsettings.value("saveState", self.saveState()))
        self.move(qsettings.value("pos", self.pos()))
        self.resize(qsettings.value("size", self.size()))
        if qsettings.value("maximized", self.isMaximized()):
            self.showMaximized()

        qsettings.endGroup()
コード例 #53
0
 def showOrHideSortAs(self):
     settings = QSettings()
     alwaysShowSortAs = bool(
         int(
             settings.value(Gopt.Key.AlwaysShowSortAs,
                            Gopt.Default.AlwaysShowSortAs)))
     editable = not self.calcSortAsCheckBox.isChecked()
     visible = alwaysShowSortAs or editable
     for widget in (self.sortAsLabel, self.sortAsEdit):
         widget.setVisible(visible)
         widget.setEnabled(editable)