Example #1
0
    def __init__(self, systray=True, debug=False, reset=False, parent=None):
        """
		Constructor.

		Keyword arguments:
		systray		--	Enables the system tray icon (default=True)
		debug		--	Enable debugging output (default=False)
		reset		--	Reset preferences (default=False)
		parent		--	Parent QWidget (default=None)
		"""

        QMainWindow.__init__(self, parent)
        self.loadUi('qnotero')
        if not reset:
            self.restoreState()
        self.debug = debug
        self.reInit()
        self.noResults()
        if systray:
            self.sysTray = SysTray(self)
            self.sysTray.show()
            self.minimizeOnClose = True
        else:
            self.minimizeOnClose = False
        if getConfig(u"firstRun") or not os.path.exists(
                getConfig('zoteroPath')):
            self.preferences(firstRun=True)
        if getConfig(u"autoUpdateCheck"):
            self.updateCheck()
Example #2
0
	def __init__(self, systray=True, debug=False, reset=False, parent=None):

		"""
		Constructor.

		Keyword arguments:
		systray		--	Enables the system tray icon (default=True)
		debug		--	Enable debugging output (default=False)
		reset		--	Reset preferences (default=False)
		parent		--	Parent QWidget (default=None)
		"""

		QMainWindow.__init__(self, parent)
		self.loadUi('qnotero')
		if not reset:
			self.restoreState()
		self.debug = debug
		self.reInit()
		self.noResults()
		if systray:
			self.sysTray = SysTray(self)
			self.sysTray.show()
			self.minimizeOnClose = True
		else:
			self.minimizeOnClose = False
		if getConfig(u"firstRun") or not os.path.exists(getConfig('zoteroPath')):
			self.preferences(firstRun=True)
		if getConfig(u"autoUpdateCheck"):
			self.updateCheck()
Example #3
0
 def eventFilter(self, source: 'QObject', e: 'QEvent') -> bool:
     if (e.type() == QtCore.QEvent.ContextMenu and source is
             self.ui.listWidgetResults):
         contextMenu = QMenu(self)
         actCopyAuthordate = contextMenu.addAction(u"Copy author(s) and year")
         actCopyDOI = contextMenu.addAction(u"Copy DOI")
         actCopyTitle = contextMenu.addAction(u"Copy title")
         actCopyAbs = contextMenu.addAction(u"Copy abstract")
         actCopyRef = contextMenu.addAction(u"Copy Reference")
         action = contextMenu.exec_(self.mapToGlobal(e.pos()))
         item = source.itemAt(e.pos())
         if (action is None) or (item is None):
             return True
         clipboard = QtGui.QApplication.clipboard()
         clipboard.clear(mode=clipboard.Clipboard)
         if action is actCopyAuthordate:
             clipboard.setText(item.zoteroItem.author_date_format(), mode=clipboard.Clipboard)
             return True
         elif action is actCopyDOI:
             if item.zoteroItem.doi is not None:
                 clipboard.setText(item.zoteroItem.doi, mode=clipboard.Clipboard)
             return True
         elif action is actCopyTitle:
             title = item.zoteroItem.format_title()
             if title is not None:
                 clipboard.setText(title, mode=clipboard.Clipboard)
             return True
         elif action is actCopyAbs:
             if item.zoteroItem.abstract is not None:
                 clipboard.setText(item.zoteroItem.abstract, mode=clipboard.Clipboard)
             return True
         elif action is actCopyRef:
             clipboard.setText(item.zoteroItem.full_format(), mode=clipboard.Clipboard)
             return True
     return QMainWindow.eventFilter(self, source, e)
Example #4
0
    def close(self):
        """Exits the program."""

        self.minimizeOnClose = False
        QMainWindow.close(self)
Example #5
0
	def close(self):

		"""Exits the program."""

		self.minimizeOnClose = False
		QMainWindow.close(self)