Exemplo n.º 1
0
Arquivo: ui.py Projeto: kzwkt/dff
 def __init__(self, argv):
     self.argv = argv
     self.graphical = 0
     self.test = ''
     self.confPath = ''
     self.debug = False
     self.verbosity = 0
     self.batch = None
     # Configuration
     self.main()
     self.conf = Conf(self.confPath)
Exemplo n.º 2
0
 def addHelpWidget(self):
     conf = Conf()
     path = conf.docPath
     file = QFile(path)
     if not file.exists(path):
         if path:
             dialog = QMessageBox.warning(
                 self, self.errorLoadingHelp,
                 QString(path) + ": " + self.notAnHelpFile)
         else:
             dialog = QMessageBox.warning(self, self.errorLoadingHelp,
                                          self.noSuchHelpFile)
         return
     self.addDockWidgets(Help(self, path=path), 'help')
Exemplo n.º 3
0
 def __init__(self):
     self.translators = {}
     self.conf = Conf()
     if hasattr(sys, "frozen"):
         translationPath = os.path.abspath(
             os.path.join(os.path.dirname(sys.executable),
                          "resources/i18n"))
         self.addTranslationPath(os.path.join(translationPath, "qt_"))
         self.addTranslationPath(os.path.join(translationPath, "Dff_"))
     else:
         self.addTranslationPath(
             os.path.join(
                 unicode(
                     QLibraryInfo.location(
                         QLibraryInfo.TranslationsPath)), "qt_"))
         self.addTranslationPath("dff/ui/gui/i18n/Dff_")
     self.loadLanguage()
Exemplo n.º 4
0
 def addHelpWidget(self):
     if hasattr(sys, "frozen"):
         path = os.path.abspath(
             os.path.join(os.path.dirname(sys.executable),
                          "resources/docs/dff_doc.qhc"))
     else:
         conf = Conf()
         path = conf.docPath
     file = QFile(path)
     if not file.exists(path):
         if path:
             dialog = QMessageBox.warning(
                 self, self.errorLoadingHelp,
                 QString(path) + ": " + self.notAnHelpFile)
         else:
             dialog = QMessageBox.warning(self, self.errorLoadingHelp,
                                          self.noSuchHelpFile)
         return
     self.addDockWidgets(Help(self, path=path), 'help')
Exemplo n.º 5
0
 def __init__(self):
     self.conf = Conf()
     self.hist = []
     self.wfile = None
     self.current = 0
     self.load()
Exemplo n.º 6
0
        def __init__(self):
            self.dff = QTranslator()

            self.generic = QTranslator()
            self.Conf = Conf()
            self.loadLanguage()
Exemplo n.º 7
0
    def __init__(self, parent = None):
      """ Drives preferences Dialog

      TODO
       - Valide index settings are properly handle by indexer
      """
      
      super(QDialog, self).__init__()
      
      # Set up the user interface from Qt Designer
      self.setupUi(self)
      self.translation()

      # Framework singleton classes
      self.conf = Conf()
      self.translator = Translator()

      # Temporary config, to be validated once submited
      self.tNoFootPrint = self.conf.noFootPrint
      self.tNoHistoryFile = self.conf.noHistoryFile
      self.tWorkPath = self.conf.workingDir
      self.tHistoryFileFullPath = self.conf.historyFileFullPath

      if self.conf.indexEnabled:
          self.tRootIndex = self.conf.root_index
          self.tIndexName = self.conf.index_name
          self.tIndexPath = self.conf.index_path
      else:
          idx = self.tabWidget.indexOf(self.indexTab)
          self.tabWidget.removeTab(idx)
      # Activate preferences from conf values
      self.noFootPrintCheckBox.setChecked(self.conf.noFootPrint)
      self.noHistoryCheckBox.setChecked(self.conf.noHistoryFile)
      self.footprintOrNo()

      self.workingDirPath.setText(self.conf.workingDir)
      self.historyLineEdit.setText(self.conf.historyFileFullPath)
      self.docAndHelpFullPath.setText(self.conf.docPath)
      
      # Populate languages comboBox with available languages, also set to current language
      self.langPopulate()

      # Signals handling
      self.connect(self.noFootPrintCheckBox, SIGNAL("stateChanged(int)"), self.noFootPrintChanged)
      self.connect(self.workingDirBrowse, SIGNAL("clicked()"), self.workDir)
      self.connect(self.historyToolButton, SIGNAL("clicked()"), self.historyDir)
      self.connect(self.noHistoryCheckBox, SIGNAL("stateChanged(int)"), self.historyStateChanged)
      self.connect(self.langComboBox, SIGNAL("currentIndexChanged (const QString&)"), self.langChanged)

      # Help configuration
      self.connect(self.docAndHelpBrowse, SIGNAL("clicked()"), self.helpDir)

      # Show or hide label helpers
      self.globalValid()
      self.helpValid()
      
      if parent:
          self.app = parent.app
      else:
          self.app = None

      # Catch submit to create directories if needed
      self.connect(self.buttonBox, SIGNAL("accepted()"), self.validate)
      self.connect(self.buttonBox, SIGNAL("rejected()"), self.clear)