modules.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:gpt 作者: encarsia 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号