Ejemplo n.º 1
0
    def __init__(self, qnotero, firstRun=False):
        """
		Constructor

		Arguments:
		qnotero -- a Qnotero instance

		Keyword arguments:
		firstRun -- indicates if the first run message should be shown
					(default=False)
		"""

        QDialog.__init__(self)
        self.qnotero = qnotero
        self.loadUi('preferences')
        self.ui.labelLocatePath.hide()
        if not firstRun:
            self.ui.labelFirstRun.hide()
        self.ui.labelTitleMsg.setText(self.ui.labelTitleMsg.text().replace(
            u"[version]", self.qnotero.version))
        self.ui.pushButtonZoteroPathAutoDetect.clicked.connect(
            self.zoteroPathAutoDetect)
        self.ui.pushButtonZoteroPathBrowse.clicked.connect(
            self.zoteroPathBrowse)
        self.ui.checkBoxAutoUpdateCheck.setChecked(
            getConfig(u"autoUpdateCheck"))
        self.ui.checkBoxShowAbstract.setChecked(getConfig(u'showAbstract'))
        self.ui.lineEditZoteroPath.setText(getConfig(u"zoteroPath"))
        i = 0
        pos = getConfig(u'pos')
        while True:
            self.ui.comboBoxPos.setCurrentIndex(i)
            if self.ui.comboBoxPos.currentText() == pos:
                break
            i += 1
        i = 0
        import libqnotero._themes
        themePath = os.path.dirname(libqnotero._themes.__file__)
        if platform.system() == 'Darwin' and hasattr(sys, 'frozen'):
            themePath = os.path.join(os.path.dirname(sys.executable),
                                     u'themes')
            for dirname in next(os.walk(themePath))[1]:
                self.ui.comboBoxTheme.addItem(dirname)
                if dirname == getConfig(u"theme").lower():
                    self.ui.comboBoxTheme.setCurrentIndex(i)
                i += 1
        else:
            for _, theme, _ in pkgutil.iter_modules([themePath]):
                self.ui.comboBoxTheme.addItem(theme)
                if theme == getConfig(u"theme").lower():
                    self.ui.comboBoxTheme.setCurrentIndex(i)
                i += 1
        i = 0
        for style in QStyleFactory.keys():
            self.ui.comboBoxStyle.addItem(style)
            if style == getConfig(u'appStyle'):
                self.ui.comboBoxStyle.setCurrentIndex(i)
            i += 1
        self.adjustSize()
Ejemplo n.º 2
0
    def accept(self):
        """Accept the changes"""

        if self.ui.labelLocatePath.isVisible():
            return
        print('saving!')
        setConfig(u"firstRun", False)
        setConfig(u"pos", self.ui.comboBoxPos.currentText())
        setConfig(u"autoUpdateCheck",
                  self.ui.checkBoxAutoUpdateCheck.isChecked())
        setConfig(u"zoteroPath", self.ui.lineEditZoteroPath.text())
        setConfig(u"theme", self.ui.comboBoxTheme.currentText().capitalize())
        self.qnotero.saveState()
        self.qnotero.reInit()
        QDialog.accept(self)
Ejemplo n.º 3
0
	def accept(self):

		"""Accept the changes"""

		if self.ui.labelLocatePath.isVisible():
			return
		print('saving!')
		setConfig(u"firstRun", False)
		setConfig(u"pos", self.ui.comboBoxPos.currentText())
		setConfig(u"autoUpdateCheck",
			self.ui.checkBoxAutoUpdateCheck.isChecked())
		setConfig(u"zoteroPath", self.ui.lineEditZoteroPath.text())
		setConfig(u"theme", self.ui.comboBoxTheme.currentText().capitalize())
		self.qnotero.saveState()
		self.qnotero.reInit()
		QDialog.accept(self)
Ejemplo n.º 4
0
    def __init__(self, qnotero, firstRun=False):
        """
		Constructor

		Arguments:
		qnotero -- a Qnotero instance

		Keyword arguments:
		firstRun -- indicates if the first run message should be shown
					(default=False)
		"""

        QDialog.__init__(self)
        self.qnotero = qnotero
        self.loadUi('preferences')
        self.ui.labelLocatePath.hide()
        if not firstRun:
            self.ui.labelFirstRun.hide()
        self.ui.labelTitleMsg.setText(self.ui.labelTitleMsg.text().replace(
            u"[version]", self.qnotero.version))
        self.ui.pushButtonZoteroPathAutoDetect.clicked.connect(
            self.zoteroPathAutoDetect)
        self.ui.pushButtonZoteroPathBrowse.clicked.connect(
            self.zoteroPathBrowse)
        self.ui.checkBoxAutoUpdateCheck.setChecked(
            getConfig(u"autoUpdateCheck"))
        self.ui.lineEditZoteroPath.setText(getConfig(u"zoteroPath"))
        i = 0
        import libqnotero._themes
        themePath = os.path.dirname(libqnotero._themes.__file__)
        for _, theme, _ in pkgutil.iter_modules([themePath]):
            self.ui.comboBoxTheme.addItem(theme)
            if theme == getConfig(u"theme").lower():
                self.ui.comboBoxTheme.setCurrentIndex(i)
            i += 1
        icon = getConfig(u"iconOverride")
        self.ui.comboBoxIcon.setCurrentIndex(
            icons.index(icon) if icon in icons else 0)
        self.setStyleSheet(self.qnotero.styleSheet())
        self.adjustSize()
Ejemplo n.º 5
0
	def __init__(self, qnotero, firstRun=False):

		"""
		Constructor

		Arguments:
		qnotero -- a Qnotero instance

		Keyword arguments:
		firstRun -- indicates if the first run message should be shown
					(default=False)
		"""

		QDialog.__init__(self)
		self.qnotero = qnotero
		self.loadUi('preferences')
		self.ui.labelLocatePath.hide()
		if not firstRun:
			self.ui.labelFirstRun.hide()
		self.ui.labelTitleMsg.setText(
			self.ui.labelTitleMsg.text().replace(u"[version]", 
				self.qnotero.version))
		self.ui.pushButtonZoteroPathAutoDetect.clicked.connect(
			self.zoteroPathAutoDetect)
		self.ui.pushButtonZoteroPathBrowse.clicked.connect(
			self.zoteroPathBrowse)
		self.ui.checkBoxAutoUpdateCheck.setChecked(getConfig(u"autoUpdateCheck"))
		self.ui.lineEditZoteroPath.setText(getConfig(u"zoteroPath"))
		i = 0
		import libqnotero._themes
		themePath = os.path.dirname(libqnotero._themes.__file__)
		for _, theme, _ in pkgutil.iter_modules([themePath]):
			self.ui.comboBoxTheme.addItem(theme)
			if theme == getConfig(u"theme").lower():
				self.ui.comboBoxTheme.setCurrentIndex(i)
			i += 1
		self.setStyleSheet(self.qnotero.styleSheet())
		self.adjustSize()
Ejemplo n.º 6
0
    def reject(self):
        """Reject changes"""

        if not self.ui.labelLocatePath.isVisible():
            QDialog.reject(self)
Ejemplo n.º 7
0
	def reject(self):

		"""Reject changes"""

		if not self.ui.labelLocatePath.isVisible():
			QDialog.reject(self)