Example #1
0
    def setZoteroPath(self, path):
        """
		Validate and set the Zotero path

		Arguments:
		path -- the Zotero path
		"""

        if valid_location(path):
            self.ui.lineEditZoteroPath.setText(path)
        else:
            QMessageBox.information(
                self, u"Invalid Zotero path",
                u"The folder you selected does not contain 'zotero.sqlite'")
Example #2
0
	def setZoteroPath(self, path):

		"""
		Validate and set the Zotero path

		Arguments:
		path -- the Zotero path
		"""

		if valid_location(path):
			self.ui.lineEditZoteroPath.setText(path)
		else:
			QMessageBox.information(self, u"Invalid Zotero path",
				u"The folder you selected does not contain 'zotero.sqlite'")
Example #3
0
	def zoteroPathAutoDetect(self):

		"""Auto-detect the Zotero folder"""

		self.ui.labelLocatePath.show()
		if os.name == u"nt":
			home= os.environ[u"USERPROFILE"]
		elif os.name == u"posix":
			home = os.environ[u"HOME"]
		zoteroPath = self.locate(home, u"zotero.sqlite")
		if zoteroPath == None:
			QMessageBox.information(self, u"Unable to find Zotero",
				u"Unable to find Zotero. Please specify the Zotero folder manually.")
		else:
			self.ui.lineEditZoteroPath.setText(zoteroPath)
		self.ui.labelLocatePath.hide()
Example #4
0
    def zoteroPathAutoDetect(self):
        """Auto-detect the Zotero folder"""

        self.ui.labelLocatePath.show()
        if os.name == u"nt":
            home = os.environ[u"USERPROFILE"]
        elif os.name == u"posix":
            home = os.environ[u"HOME"]
        zoteroPath = self.locate(home, u"zotero.sqlite")
        if zoteroPath == None:
            QMessageBox.information(
                self, u"Unable to find Zotero",
                u"Unable to find Zotero. Please specify the Zotero folder manually."
            )
        else:
            self.ui.lineEditZoteroPath.setText(zoteroPath)
        self.ui.labelLocatePath.hide()
Example #5
0
    def zoteroPathAutoDetect(self):
        """Auto-detect the Zotero folder"""

        self.ui.labelLocatePath.show()
        if platform.system() == u"Windows":
            home = os.environ[u"USERPROFILE"]
        elif platform.system() == u"Linux" or platform.system() == u'Darwin':
            home = os.environ[u"HOME"]
        zoteroPath = self.locate(os.path.join(home, u'Zotero'),
                                 u"zotero.sqlite")
        if zoteroPath is None:
            zoteroPath = self.locate(home, u"zotero.sqlite")
        if zoteroPath is None:
            QMessageBox.information(
                self, u"Unable to find Zotero",
                u"Unable to find Zotero. Please specify the Zotero folder manually."
            )
        else:
            self.ui.lineEditZoteroPath.setText(zoteroPath)
        self.ui.labelLocatePath.hide()
Example #6
0
    def updateCheck(self):
        """Checks for updates if update checking is on."""

        if not getConfig(u"autoUpdateCheck"):
            return True
        import urllib.request
        from distutils.version import LooseVersion
        print(u"qnotero.updateCheck(): opening %s" % getConfig(u"updateUrl"))
        try:
            fd = urllib.request.urlopen(getConfig(u"updateUrl"))
            mrv = fd.read().decode('utf-8').strip()
        except:
            print('qnotero.updateCheck(): failed to check for update')
            return
        print("qnotero.updateCheck(): most recent = %s, current = %s" \
         % (mrv, self.version))
        if LooseVersion(mrv) > LooseVersion(self.version):
            QMessageBox.information(
                self, 'Update found',
                ('A new version of Qnotero is available! Please visit '
                 'http://www.cogsci.nl/qnotero for more information.'))
Example #7
0
	def updateCheck(self):

		"""Checks for updates if update checking is on."""

		if not getConfig(u"autoUpdateCheck"):
			return True
		import urllib.request
		from distutils.version import LooseVersion
		print(u"qnotero.updateCheck(): opening %s" % getConfig(u"updateUrl"))
		try:
			fd = urllib.request.urlopen(getConfig(u"updateUrl"))
			mrv = fd.read().decode('utf-8').strip()
		except:
			print('qnotero.updateCheck(): failed to check for update')
			return
		print("qnotero.updateCheck(): most recent = %s, current = %s" \
			% (mrv, self.version))
		if LooseVersion(mrv) > LooseVersion(self.version):		
			QMessageBox.information(self, 'Update found',
				('A new version of Qnotero is available! Please visit '
				'http://www.cogsci.nl/qnotero for more information.'))