コード例 #1
0
ファイル: app.py プロジェクト: ashumeow/grail
 def __init__(self, prefs=None):
     utils._grail_app = self
     if prefs is None:
         import GrailPrefs
         self.prefs = GrailPrefs.AllPreferences()
     else:
         self.prefs = prefs
     self.graildir = utils.getgraildir()
     user_icons = os.path.join(self.graildir, 'icons')
     utils.establish_dir(self.graildir)
     utils.establish_dir(user_icons)
     self.iconpath = [
         user_icons, os.path.join(utils.get_grailroot(), 'icons')]
     #
     self.__loaders = {}
     #
     # Add our type map file to the set used to initialize the shared map:
     #
     typefile = os.path.join(self.graildir, "mime.types") 
     mimetypes.init(mimetypes.knownfiles + [typefile])
コード例 #2
0
 def Editable(self):
     """Ensure that the user has a graildir and it is editable."""
     if not utils.establish_dir(os.path.split(self.filename)[0]):
         return 0
     elif os.path.exists(self.filename):
         return 1
     else:
         try:
             tempf = open(self.filename, 'a')
             tempf.close()
             return 1
         except os.error:
             return 0
コード例 #3
0
 def Editable(self):
     """Ensure that the user has a graildir and it is editable."""
     if not utils.establish_dir(os.path.split(self.filename)[0]):
         return 0
     elif os.path.exists(self.filename):
         return 1
     else:
         try:
             tempf = open(self.filename, 'a')
             tempf.close()
             return 1
         except os.error:
             return 0
コード例 #4
0
 def __init__(self, prefs=None):
     utils._grail_app = self
     if prefs is None:
         import GrailPrefs
         self.prefs = GrailPrefs.AllPreferences()
     else:
         self.prefs = prefs
     self.graildir = utils.getgraildir()
     user_icons = os.path.join(self.graildir, 'icons')
     utils.establish_dir(self.graildir)
     utils.establish_dir(user_icons)
     self.iconpath = [
         user_icons,
         os.path.join(utils.get_grailroot(), 'icons')
     ]
     #
     self.__loaders = {}
     #
     # Add our type map file to the set used to initialize the shared map:
     #
     typefile = os.path.join(self.graildir, "mime.types")
     mimetypes.init(mimetypes.knownfiles + [typefile])