コード例 #1
0
    def findSizes(self,font):
        fontLogger.debug("font.key()=%s" % font.key())
        fontDatabase = QFontDatabase()

        self.sizeCombo.blockSignals(True)
        self.sizeCombo.clear()

        self.sizeComboFs.blockSignals(True)
        self.sizeComboFs.clear()

        styleStr = fontDatabase.styleString(font)
        if fontDatabase.isSmoothlyScalable(font.family(),styleStr):
            for size in QFontDatabase.standardSizes():
                self.sizeCombo.addItem(str(size))
                self.sizeComboFs.addItem(str(size))
        else:
            for size in fontDatabase.smoothSizes(font.family(),styleStr):
                self.sizeCombo.addItem(str(size))
                self.sizeComboFs.addItem(str(size))

        self.sizeCombo.blockSignals(False)
        self.sizeComboFs.blockSignals(False)

        currentSize = unicode(QSettings().value("worksheet/fontsize",
                                                QtReduceDefaults.FONTSIZE))
        sizeIndex = self.sizeCombo.findText(currentSize)
        self.sizeCombo.setCurrentIndex(sizeIndex)

        currentSize = unicode(QSettings().value("worksheet/fontsizefs",
                                                QtReduceDefaults.FONTSIZEFS))
        sizeIndex = self.sizeCombo.findText(currentSize)
        self.sizeComboFs.setCurrentIndex(sizeIndex)
コード例 #2
0
 def zoomDef(self, fullScreen):
     if fullScreen:
         fs = int(QSettings().value("worksheet/fontsizefs",
                                    QtReduceDefaults.FONTSIZEFS))
     else:
         fs = int(QSettings().value("worksheet/fontsize",
                                    QtReduceDefaults.FONTSIZE))
     self.setupFont(fs)
コード例 #3
0
    def __init__(self, app):
        super(MainWindow, self).__init__()

        # Window layout - a splitter with the image on the left and controls
        # on the right
        self._image_widget = ImageLabel(self)
        self._controls = Controls(self)
        self._splitter = QSplitter()
        self._splitter.addWidget(self._image_widget)
        self._splitter.addWidget(self._controls)
        self._splitter.setSizes([1200, 600])

        # Main window layout
        self.setCentralWidget(self._splitter)

        # Connect controls to handlers
        self._controls.ok.clicked.connect(self.ok)
        self._controls.cancel.clicked.connect(self.cancel)
        self._controls.inbox.choose_directory.clicked.connect(
            self.choose_inbox)
        self._controls.processed.choose_directory.clicked.connect(
            self.choose_processed)

        # Directories
        mydocuments = QDesktopServices.storageLocation(
            QDesktopServices.DocumentsLocation)
        self._inbox = Path(QSettings().value('inbox',
                                             str(Path(mydocuments) / 'inbox')))
        self._processed = Path(QSettings().value(
            'processed', str(Path(mydocuments) / 'processed')))

        self._controls.inbox.set_link(str(self._inbox.as_uri()),
                                      self._inbox.name)
        self._controls.processed.set_link(str(self._processed.as_uri()),
                                          self._processed.name)

        # A stack of Path objects to be processed
        self._pending_files = []

        # The Path currently shown in the UI
        self._under_review = None

        # Watch the inbox directory, if it exists
        self.new_pending_files.connect(self.process_next_pending,
                                       QtCore.Qt.QueuedConnection)

        if self._inbox.is_dir():
            self._watcher = NewFileWatcher(self._inbox, IMAGE_SUFFIXES_RE)
            self._watcher.new_file.connect(self.new_image_file)
        else:
            self._watcher = None

        self.empty_controls()

        # Setup drag-drop handling
        self.setAcceptDrops(True)
        self._controls.installEventFilter(self)
        self._splitter.installEventFilter(self)
コード例 #4
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'})
コード例 #5
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)
コード例 #6
0
    def __init__(self,parent=None):
        super(QtReducePreferencesComputation,self).__init__(parent)

        reduceGroup = QGroupBox("Reduce")

        self.reduceBinary = QLineEdit()

        # font = self.reduceBinary.font()
        # font.setFamily(QSettings().value("worksheet/fontfamily",
        #                                QtReduceDefaults.FONTFAMILY))
        # self.reduceBinary.setFont(font)

        self.reduceBinary.setText(QSettings().value("computation/reduce",
                                                    QtReduceDefaults.REDUCE))

        self.reduceBinary.editingFinished.connect(self.editingFinishedHandler)

        reduceLayout = QFormLayout()
        reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary)

        reduceGroup.setLayout(reduceLayout)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(reduceGroup)

        self.setLayout(mainLayout)
コード例 #7
0
    def __createContents(self):
        self.contentsWidget = QListWidget()
        self.contentsWidget.setViewMode(QListView.ListMode)
        self.contentsWidget.setMovement(QListView.Static)

        toolBar = QListWidgetItem(self.contentsWidget)
        toolBar.setText(self.tr("Toolbar"))
        toolBar.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        worksheet = QListWidgetItem(self.contentsWidget)
        worksheet.setText(self.tr("Worksheet"))
        worksheet.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        computation = QListWidgetItem(self.contentsWidget)
        computation.setText(self.tr("Computation"))
        computation.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        currentItem = QSettings().value("preferences/currentitem",
                                        self.tr(QtReduceDefaults.CURRENTITEM))
        if currentItem == self.tr("Toolbar"):
            self.contentsWidget.setCurrentItem(toolBar)
        elif currentItem == self.tr("Worksheet"):
            self.contentsWidget.setCurrentItem(worksheet)
        elif currentItem == self.tr("Computation"):
            self.contentsWidget.setCurrentItem(computation)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
コード例 #8
0
ファイル: lib.py プロジェクト: Aserun/mauto
 def repository(self, value):
     settings = QSettings("csaez", "mauto")
     settings.setValue("repo", value)
     if not os.path.exists(value):
         os.makedirs(value)
     self._repo = value
     self.reload()
コード例 #9
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)
コード例 #10
0
   def __init__(self):
      super(GuiSettings, self).__init__()
      
      settings = QSettings("Joey", "AMacro")
      
    
      exit_action = QtGui.QAction(QtGui.QIcon('exit.png'), '&Exit', self)        
      exit_action.setShortcut('Ctrl+Q')
      exit_action.setStatusTip('Exit application')
      exit_action.triggered.connect(QtGui.qApp.quit)
            
#       menubar = self.menuBar()
#       file_menu = menubar.addMenu('&File')
#       file_menu.addAction(exit_action)
# 
#       self.status_bar = QtGui.QStatusBar(self)
#       self.status_bar.setObjectName(_fromUtf8("statusbar"))
#       self.status_bar.setToolTip("Initialized")
#       self.setStatusBar(self.status_bar)
#       
#       QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
#       self.setToolTip('Macro Control GUI')
      

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

      
#       self.setWindowTitle('Android Macro Control')  
      self.setGeometry(300, 300, 600, 800)
コード例 #11
0
ファイル: app.py プロジェクト: bwprice/inselect
    def open_file(self, path=None):
        """Opens path, which can be None, the path to an inselect document or
        the path to an image file. If None, the user is prompted to select a
        file.

        * If a .inselect file, the file is opened
        * If an image file for which a .inselect document already exists, the
        .inselect file is opened
        * If a _thumbnail.jpg file corresponding to an existing .inselect file,
        the .inselect file is opened
        * If an image file, a new .inselect file is created and opened
        """
        debug_print(u'MainWindow.open_file [{0}]'.format(path))

        if not path:
            folder = QSettings().value(
                'working_directory',
                QDesktopServices.storageLocation(
                    QDesktopServices.DocumentsLocation))

            filter = u'Inselect documents (*{0});;Images ({1})'
            filter = filter.format(InselectDocument.EXTENSION,
                                   u' '.join(IMAGE_PATTERNS))
            path, selectedFilter = QtGui.QFileDialog.getOpenFileName(
                self, "Open", folder, filter)

        if path:
            # Will be None if user cancelled getOpenFileName
            if not self.close_document():
                # User does not want to close the existing document
                pass
            else:
                path = Path(path)

                if path.suffix in IMAGE_SUFFIXES:
                    # Compute the path to the inselect document (which may or
                    # may not already exist) of the image file
                    doc_of_image = path.name.replace(
                        InselectDocument.THUMBNAIL_SUFFIX, u'')
                    doc_of_image = path.parent / doc_of_image
                    doc_of_image = doc_of_image.with_suffix(
                        InselectDocument.EXTENSION)
                else:
                    doc_of_image = None

                if InselectDocument.EXTENSION == path.suffix:
                    # Open the .inselect document
                    debug_print('Opening inselect document [{0}]'.format(path))
                    self.open_document(path)
                elif doc_of_image and doc_of_image.is_file():
                    # An image file corresponding to an existing .inselect file
                    msg = u'Opening inselect document [{0}] of thumbnail [{1}]'
                    debug_print(msg.format(doc_of_image, path))
                    self.open_document(doc_of_image)
                elif path.suffix in IMAGE_SUFFIXES:
                    msg = u'Creating new inselect document for image [{0}]'
                    debug_print(msg.format(path))
                    self.new_document(path)
                else:
                    raise InselectError('Unknown file type [{0}]'.format(path))
コード例 #12
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()
コード例 #13
0
def get_settings():
    """
    Creates a `QSettings` object set up for the application.
    Returns a `QSettings` object.
    """

    return QSettings('IQStorage', 'IQBox')
コード例 #14
0
 def __init__(self, parent=None):
     super(QtReduceTextEdit, self).__init__(parent)
     self.setupFont(
         int(QSettings().value("worksheet/fontsize",
                               QtReduceDefaults.FONTSIZE)))
     self.textChanged.connect(self.textChangedHandler)
     self.setCursorWidth(1)
コード例 #15
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)
コード例 #16
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)

        self.current_directory = None

        self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope,
                                  COMPANY, APPNAME)
        self.restoreGeometry(self.settings.value(self.__class__.__name__))
        self.splitter.restoreState(self.settings.value(SPLITTER))
        self.current_directory = self.settings.value(CURRENT_DIRECTORY)

        self.white_albatross = WhiteAlbatrossWidget()
        self.white_albatross.figuresChanged.connect(self.on_figures_changed)
        self.workLayout.insertWidget(1, self.white_albatross)

        self.type.currentIndexChanged.connect(self.white_albatross.setType)
        self.type.setCurrentIndex(
            int(self.settings.value(LAST_FIGURE_TYPE, defaultValue=0)))

        self.addImages.clicked.connect(self.add_images_click)
        self.openFolder.clicked.connect(self.open_folder_clicked)
        self.removeImages.clicked.connect(self.remove_images)
        self.imagesList.itemSelectionChanged.connect(self.item_selected)
        self.deleteFigure.clicked.connect(self.delete_figure)

        self.figures.customContextMenuRequested.connect(
            self.figures_context_menu)

        if self.current_directory:
            self.open_folder()
        self.imagesList.setCurrentRow(
            int(self.settings.value(SELECTED_IMAGE, defaultValue=0)))
コード例 #17
0
    def setUp(self):
        self.settings = QSettings('com.nokia.qt.serviceframework.tests',
                                  'SampleServicePlugin')
        self.manager = QServiceManager()

        self.serviceXml = os.path.join(os.path.dirname(__file__),
                                       'sampleservice.xml')
コード例 #18
0
    def save_ini(self):
        settings = QSettings('config.ini', QSettings.IniFormat)

        settings.beginGroup(self.__class__.__name__)
        settings.setValue('Geometry', self.saveGeometry())
        settings.setValue('splitter', self.splitter.saveState())
        settings.endGroup()
コード例 #19
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()
コード例 #20
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)
コード例 #21
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('')
コード例 #22
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)
コード例 #23
0
ファイル: Display.py プロジェクト: ra2003/xindex
 def setShowMainWindowToolTips(self):
     showMainWindowToolTips = int(
         self.showMainWindowToolTipsCheckBox.isChecked())
     settings = QSettings()
     settings.setValue(Gopt.Key.ShowMainWindowToolTips,
                       showMainWindowToolTips)
     self.state.window.updateToolTips()
コード例 #24
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)
コード例 #25
0
ファイル: Display.py プロジェクト: ra2003/xindex
 def onDisplayMonoFontChange(self, propagate=True):
     font = QFont(self.displaymonoFontComboBox.currentFont())
     font.setPointSize(self.displaymonoFontSizeSpinBox.value())
     if propagate:
         settings = QSettings()
         settings.setValue(Gopt.Key.MonoFont, font.family())
         settings.setValue(Gopt.Key.MonoFontSize, font.pointSize())
         self.state.updateDisplayFonts()
コード例 #26
0
def QsaveParameter(paramName, paramValue, quiet=False):
    from PySide.QtCore import QSettings

    if quiet == False:
        print('saving Qparameter: %s' % paramName)
        print('    parameter value: ', paramValue)
    settings = QSettings("TCfA", "CPEDS")
    settings.setValue(paramName, paramValue)
コード例 #27
0
    def __init__(self):
        # init settings only once
        if not MTTSettings._SETTINGS:
            MTTSettings._SETTINGS = QSettings(
                QSettings.IniFormat, QSettings.UserScope,
                'Bioeden', 'mtt')

            MTTSettings.__load_json_settings()
コード例 #28
0
    def __init__(self):
        assert self._instance == None
        Config._instance = self
        QCoreApplication.setOrganizationName("nicolas.carrier")
        QCoreApplication.setApplicationVersion(version)
        QCoreApplication.setApplicationName("gem")

        self.__settings = QSettings()
コード例 #29
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>"""))
コード例 #30
0
    def __init__(self, argv, debug=False):
        super(Application, self).__init__(argv)

        logging.basicConfig()

        if debug:
            # set debug logging
            logging.getLogger().setLevel(logging.DEBUG)

        if version.DEVELOPER_MODE:
            #print "hi devolopper!"
            # print info about developer's mode to possibly prevent it being
            # forgotten about when releasing
            logging.info(
                "Developer's mode enabled - recompiling all .ui files...")

            # in case we are in the developer's mode,
            # lets compile all UI files to ensure they are up to date
            from ceed import compileuifiles
            compileuifiles.main()

            logging.debug("All .ui files recompiled!")

        from ceed import settings
        self.qsettings = QSettings("Iromy", "UIromy Editor")
        self.settings = settings.Settings(self.qsettings)
        # download all values from the persistence store
        self.settings.download()

        showSplash = settings.getEntry("global/app/show_splash").value
        if showSplash:
            self.splash = SplashScreen()
            self.splash.show()

            # this ensures that the splash screen is shown on all platforms
            self.processEvents()

        self.setOrganizationName("Iromy")
        self.setOrganizationDomain("Iromy.com")
        self.setApplicationName("UIromY Editor")
        self.setApplicationVersion(version.CEED)

        # (we potentially have to compile all UI files first before this is imported,
        # otherwise out of date compiled .py layouts might be used!)
        from ceed import mainwindow

        self.mainWindow = mainwindow.MainWindow(self)
        self.mainWindow.show()
        self.mainWindow.raise_()
        if showSplash:
            self.splash.finish(self.mainWindow)

        # import error after UI files have been recompiled
        # - Truncate exception log, if it exists.
        from ceed import error

        self.errorHandler = error.ErrorHandler(self.mainWindow)
        self.errorHandler.installExceptionHook()