예제 #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])