def __init__(self):
#get current directory
self.install_dir = os.getcwd()
#set up logging
FORMAT = "%(asctime)s %(funcName)-14s %(lineno)d| %(levelname)-8s | %(message)s"
logging.basicConfig(filename='gpt.log',level=logging.DEBUG,filemode='w',format=FORMAT,datefmt="%H:%M:%S")
self.log = logging.getLogger(__name__)
#Glade files/window configuration
gladefile_list = [ "tlcalculator.glade",
"gopro.glade",
"appwindow.glade",
"playerwindow.glade"]
self.gladefile = []
for f in gladefile_list:
self.gladefile.append(os.path.join(self.install_dir,"herostuff",f))
#css stylesheet
self.stylesheet = os.path.join(self.install_dir,"herostuff","gtk.css")
self.locales_dir = os.path.join(self.install_dir,'herostuff','po','locale')
self.appname = 'GPT'
#setting up localization
locale.bindtextdomain(self.appname,self.locales_dir)
locale.textdomain(self.locales_dir)
gettext.bindtextdomain(self.appname,self.locales_dir)
gettext.textdomain(self.appname)
#check for config file to set up working directory
#create file in case it does not exist
self.config = os.path.join(os.path.expanduser('~'),".config","gpt.conf")
self.defaultwdir = os.path.join(os.path.expanduser('~'),"GP")
if os.path.isfile(self.config) is False:
self.stdir = self.defaultwdir
self.chkdir(self.stdir)
self.createconfig(self.stdir)
self.kd_supp = True
else:
self.readconfig()
self.show_message(_("Working directory: %s") % self.stdir)
评论列表
文章目录