This repository has been archived by the owner on Sep 16, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 718a092
Showing
41 changed files
with
2,817 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include data/qnotero.desktop | ||
recursive-include resources | ||
recursive-exclude *.pyc | ||
recursive-include ~* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Desktop Entry] | ||
Name=Qnotero | ||
Comment=Quick access to your Zotero references | ||
TryExec=qnotero | ||
Exec=qnotero | ||
Icon=accessories-dictionary | ||
Type=Application | ||
X-GNOME-DocPath= | ||
X-GNOME-Bugzilla-Bugzilla= | ||
X-GNOME-Bugzilla-Product= | ||
X-GNOME-Bugzilla-Component= | ||
X-GNOME-Bugzilla-Version= | ||
Categories=GNOME;GTK;Utility; | ||
StartupNotify=false | ||
X-Ubuntu-Gettext-Domain=qnotero | ||
Name[en_US]=Qnotero | ||
|
Binary file not shown.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
""" | ||
This file is part of qnotero. | ||
qnotero is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
qnotero is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with qnotero. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
|
||
import sys | ||
import os | ||
import os.path | ||
from PyQt4.QtGui import QIcon, QPixmap, QLabel | ||
from PyQt4.QtCore import Qt | ||
|
||
class Default: | ||
|
||
"""The default Qnotero theme""" | ||
|
||
def __init__(self, qnotero): | ||
|
||
""" | ||
Constructor | ||
qnotero -- a Qnotero instance | ||
""" | ||
|
||
self.qnotero = qnotero | ||
if os.path.exists(os.path.join("/usr/share/qnotero/resources/", \ | ||
self.themeFolder())): | ||
self.themeFolder = os.path.join("/usr/share/qnotero/resources/", \ | ||
self.themeFolder()) | ||
else: | ||
self.themeFolder = os.path.join(os.path.dirname(sys.argv[0]), \ | ||
"resources", self.themeFolder()) | ||
self.setStyleSheet() | ||
self.qnotero.setWindowFlags(Qt.Popup) | ||
self.qnotero.ui.listWidgetResults.setHorizontalScrollBarPolicy( \ | ||
Qt.ScrollBarAlwaysOff) | ||
self.qnotero.ui.listWidgetResults.setVerticalScrollBarPolicy( \ | ||
Qt.ScrollBarAlwaysOff) | ||
|
||
def icon(self, iconName): | ||
|
||
""" | ||
Retrieves an icon from the theme | ||
Arguments: | ||
iconName -- the name of the icon | ||
Returns: | ||
A QIcon | ||
""" | ||
|
||
return QIcon(os.path.join(self.themeFolder, iconName) + ".png") | ||
|
||
def iconWidget(self, iconName): | ||
|
||
""" | ||
Return a QLabel with an icon | ||
Arguments: | ||
iconName -- the name of the icon | ||
Returns: | ||
A QLabel | ||
""" | ||
|
||
l = QLabel() | ||
l.setPixmap(self.pixmap(iconName)) | ||
return l | ||
|
||
def lineHeight(self): | ||
|
||
""" | ||
Determines the line height of the results | ||
Returns: | ||
A float (e.g., 1.1) for the line height | ||
""" | ||
|
||
return 1.1 | ||
|
||
def pixmap(self, pixmapName): | ||
|
||
""" | ||
Retrieves an icon (as QPixmap) from the theme | ||
Arguments: | ||
pixmapName -- the name of the icon | ||
Returns: | ||
A QPixmap | ||
""" | ||
|
||
return QPixmap(os.path.join(self.themeFolder, pixmapName) + ".png") | ||
|
||
def roundness(self): | ||
|
||
""" | ||
Determines the roundness of various widgets | ||
Returns: | ||
A roundness as a radius in pixels | ||
""" | ||
|
||
return 10 | ||
|
||
def setStyleSheet(self): | ||
|
||
"""Applies a stylesheet to Qnotero""" | ||
|
||
self.qnotero.setStyleSheet(open(os.path.join( \ | ||
self.themeFolder, "stylesheet.qss")).read()) | ||
|
||
def themeFolder(self): | ||
|
||
""" | ||
Determines the name of the folder containing the theme resources | ||
Returns: | ||
The name of the theme folder | ||
""" | ||
|
||
return "default" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
This file is part of qnotero. | ||
qnotero is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
qnotero is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with qnotero. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
|
||
from libqnotero._themes.default import Default | ||
|
||
class Elementary(Default): | ||
|
||
"""The Elementary Qnotero theme""" | ||
|
||
def __init__(self, qnotero): | ||
|
||
Default.__init__(self, qnotero) | ||
|
||
def themeFolder(self): | ||
|
||
return "elementary" | ||
|
||
def roundness(self): | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
""" | ||
This file is part of qnotero. | ||
qnotero is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
qnotero is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with qnotero. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
|
||
config = { | ||
"cfgVer" : 0, | ||
"zoteroPath" : "", | ||
"theme" : "Default", | ||
"pdfReader" : "xdg-open", | ||
"minQueryLength" : 3, | ||
"attachToSysTray" : True, | ||
"noteProvider" : "gnote", | ||
"firstRun" : True, | ||
} | ||
|
||
def getConfig(setting): | ||
|
||
""" | ||
Retrieve a setting | ||
Returns: | ||
A setting or False if the setting does not exist | ||
""" | ||
|
||
return config[setting] | ||
|
||
def setConfig(setting, value): | ||
|
||
""" | ||
Set a setting | ||
Arguments: | ||
setting -- the setting name | ||
value -- the setting value | ||
""" | ||
|
||
config[setting] = value | ||
config["cfgVer"] += 1 | ||
|
||
def restoreConfig(settings): | ||
|
||
""" | ||
Restore settings from a QSetting | ||
Arguments: | ||
settings -- a QSetting | ||
""" | ||
|
||
for setting, default in config.items(): | ||
if type(default) == bool: | ||
value = settings.value(setting, default).toBool() | ||
elif type(default) == str: | ||
try: | ||
value = str(settings.value(setting, default).toString()) | ||
except: | ||
value = default | ||
elif type(default) == int: | ||
value = settings.value(setting, default).toInt()[0] | ||
setConfig(setting, value) | ||
|
||
def saveConfig(settings): | ||
|
||
""" | ||
Save settings to a QSetting | ||
Arguments: | ||
setting -- a QSetting | ||
""" | ||
|
||
for setting, value in config.items(): | ||
settings.setValue(setting, value) | ||
|
Oops, something went wrong.