Load quirks from both ./ and data dir on Mac
This commit is contained in:
parent
b44f2aff01
commit
5f535088cc
2 changed files with 7 additions and 3 deletions
|
@ -47,7 +47,4 @@ Mac Bugs
|
||||||
* SS: in the one-on-one pester it resizes with the window
|
* SS: in the one-on-one pester it resizes with the window
|
||||||
* SS: but the memo one doesn't resize
|
* SS: but the memo one doesn't resize
|
||||||
* SS: and the arrows next to the time thing overlap the CLOSE button
|
* SS: and the arrows next to the time thing overlap the CLOSE button
|
||||||
* Lex: Load quirks from both ./quirks and ~/Library/Application
|
|
||||||
Support/Pesterchum/quirks to allow mac users to add quirks without
|
|
||||||
losing built in ones.
|
|
||||||
* Lex: Do the same with themes.
|
* Lex: Do the same with themes.
|
||||||
|
|
|
@ -3,6 +3,7 @@ from PyQt4 import QtGui, QtCore
|
||||||
|
|
||||||
class PythonQuirks(object):
|
class PythonQuirks(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
_datadir = os.path.join(str(QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.DataLocation)),"Pesterchum/")
|
||||||
self.home = os.getcwd()
|
self.home = os.getcwd()
|
||||||
self.quirks = {}
|
self.quirks = {}
|
||||||
self.last = {}
|
self.last = {}
|
||||||
|
@ -17,6 +18,12 @@ class PythonQuirks(object):
|
||||||
for fn in os.listdir(os.path.join(self.home, 'quirks')):
|
for fn in os.listdir(os.path.join(self.home, 'quirks')):
|
||||||
if fn.endswith('.py') and not fn.startswith('_'):
|
if fn.endswith('.py') and not fn.startswith('_'):
|
||||||
filenames.append(os.path.join(self.home, 'quirks', fn))
|
filenames.append(os.path.join(self.home, 'quirks', fn))
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
if not os.path.exists(os.path.join(_datadir, 'quirks')):
|
||||||
|
os.mkdir(os.path.join(_datadir, 'quirks'))
|
||||||
|
for fn in os.listdir(os.path.join(_datadir, 'quirks')):
|
||||||
|
if fn.endswith('.py') and not fn.startswith('_'):
|
||||||
|
filenames.append(os.path.join(_datadir, 'quirks', fn))
|
||||||
|
|
||||||
modules = []
|
modules = []
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
|
|
Loading…
Reference in a new issue