import clnch_mainwindow import clnch_ini import clnch_misc ckit.registerWindowClass( "Clnch" ) ckit.registerCommandInfoConstructor( ckit.CommandInfo ) sys.path[0:0] = [ os.path.join( ckit.getAppExePath(), 'extension' ), ] # exeと同じ位置にある設定ファイルを優先する if os.path.exists( os.path.join( ckit.getAppExePath(), 'config.py' ) ): ckit.setDataPath( ckit.getAppExePath() ) else: ckit.setDataPath( os.path.join( ckit.getAppDataPath(), clnch_resource.clnch_dirname ) ) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join( ckit.getAppExePath(), '_config.py' ) config_filename = os.path.join( ckit.dataPath(), 'config.py' ) clnch_ini.ini_filename = os.path.join( ckit.dataPath(), 'clnch.ini' ) # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists(default_config_filename): shutil.copy( default_config_filename, config_filename ) clnch_ini.read() ckit.JobQueue.createDefaultQueue()
for option in option_list: if option[0] == "-d": debug = True elif option[0] == "-p": profile = True #-------------------------------------------------------------------- ckit.registerWindowClass("Keyhac") # exeと同じ位置にある設定ファイルを優先する if os.path.exists(os.path.join(ckit.getAppExePath(), 'config.py')): ckit.setDataPath(ckit.getAppExePath()) else: ckit.setDataPath( os.path.join(ckit.getAppDataPath(), keyhac_resource.keyhac_dirname)) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join(ckit.getAppExePath(), '_config.py') config_filename = os.path.join(ckit.dataPath(), 'config.py') keyhac_ini.ini_filename = os.path.join(ckit.dataPath(), 'keyhac.ini') # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists( default_config_filename): shutil.copy(default_config_filename, config_filename) keyhac_ini.read() ckit.setThemeDefault()
import os import sys import msvcrt import configparser import ckit import clnch_debug import clnch_resource ini = None ini_filename = os.path.join( ckit.getAppDataPath(), clnch_resource.clnch_dirname, 'clnch.ini' ) dirty = False #-------------------------------------------------------------------- def read(): global ini global dirty ini = configparser.RawConfigParser() try: fd = open( ini_filename, "r", encoding="utf-8" ) msvcrt.locking( fd.fileno(), msvcrt.LK_LOCK, 1 ) ini.readfp(fd) fd.close() except: clnch_debug.printErrorInfo()
option_list, args = getopt.getopt( sys.argv[1:], "dp" ) for option in option_list: if option[0]=="-d": debug = True elif option[0]=="-p": profile = True #-------------------------------------------------------------------- ckit.registerWindowClass( "Keyhac" ) # exeと同じ位置にある設定ファイルを優先する if os.path.exists( os.path.join( ckit.getAppExePath(), 'config.py' ) ): ckit.setDataPath( ckit.getAppExePath() ) else: ckit.setDataPath( os.path.join( ckit.getAppDataPath(), keyhac_resource.keyhac_dirname ) ) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join( ckit.getAppExePath(), '_config.py' ) config_filename = os.path.join( ckit.dataPath(), 'config.py' ) keyhac_ini.ini_filename = os.path.join( ckit.dataPath(), 'keyhac.ini' ) # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists(default_config_filename): shutil.copy( default_config_filename, config_filename ) keyhac_ini.read() ckit.setThemeDefault()
left_location = option[1] elif option[0]=="-R": right_location = option[1] ckit.registerWindowClass( "Cfiler" ) ckit.registerCommandInfoConstructor( ckit.CommandInfo ) sys.path[0:0] = [ os.path.join( ckit.getAppExePath(), 'extension' ), ] # exeと同じ位置にある設定ファイルを優先する if os.path.exists( os.path.join( ckit.getAppExePath(), 'config.py' ) ): ckit.setDataPath( ckit.getAppExePath() ) else: ckit.setDataPath( os.path.join( ckit.getAppDataPath(), cfiler_resource.cfiler_dirname ) ) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join( ckit.getAppExePath(), '_config.py' ) config_filename = os.path.join( ckit.dataPath(), 'config.py' ) ini_filename = os.path.join( ckit.dataPath(), 'cfiler.ini' ) # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists(default_config_filename): shutil.copy( default_config_filename, config_filename ) _main_window = cfiler_mainwindow.MainWindow( config_filename = config_filename, ini_filename = ini_filename, debug = debug,
import clnch_ini import clnch_misc ckit.registerWindowClass("Clnch") ckit.registerCommandInfoConstructor(ckit.CommandInfo) sys.path[0:0] = [ os.path.join(ckit.getAppExePath(), 'extension'), ] # exeと同じ位置にある設定ファイルを優先する if os.path.exists(os.path.join(ckit.getAppExePath(), 'config.py')): ckit.setDataPath(ckit.getAppExePath()) else: ckit.setDataPath( os.path.join(ckit.getAppDataPath(), clnch_resource.clnch_dirname)) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join(ckit.getAppExePath(), '_config.py') config_filename = os.path.join(ckit.dataPath(), 'config.py') clnch_ini.ini_filename = os.path.join(ckit.dataPath(), 'clnch.ini') # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists( default_config_filename): shutil.copy(default_config_filename, config_filename) clnch_ini.read() ckit.JobQueue.createDefaultQueue()
import os import sys import msvcrt import configparser import ckit import clnch_debug import clnch_resource ini = None ini_filename = os.path.join(ckit.getAppDataPath(), clnch_resource.clnch_dirname, 'clnch.ini') dirty = False #-------------------------------------------------------------------- def read(): global ini global dirty ini = configparser.RawConfigParser() try: fd = open(ini_filename, "r", encoding="utf-8") msvcrt.locking(fd.fileno(), msvcrt.LK_LOCK, 1) ini.readfp(fd) fd.close() except:
debug = True elif option[0] == "-p": profile = True #-------------------------------------------------------------------- if __name__ == "__main__": ckit.registerWindowClass("keyhac") # exeと同じ位置にある設定ファイルを優先する if os.path.exists(os.path.join(ckit.getAppExePath(), 'config.py')): ckit.setDataPath(ckit.getAppExePath()) else: ckit.setDataPath( os.path.join(ckit.getAppDataPath(), keyhac_resource.keyhac_dirname)) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join(ckit.getAppExePath(), '_config.py') config_filename = os.path.join(ckit.dataPath(), 'config.py') keyhac_ini.ini_filename = os.path.join(ckit.dataPath(), 'keyhac.ini') # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists( default_config_filename): shutil.copy(default_config_filename, config_filename) keyhac_ini.read()
#-------------------------------------------------------------------- if __name__ == "__main__": ckit.registerWindowClass( "Cmemo" ) sys.path[0:0] = [ os.path.join( ckit.getAppExePath(), 'extension' ), os.path.join( ckit.getAppExePath(), 'script' ), ] # exeと同じ位置にある設定ファイルを優先する if os.path.exists( os.path.join( ckit.getAppExePath(), 'config.py' ) ): ckit.setDataPath( ckit.getAppExePath() ) else: ckit.setDataPath( os.path.join( ckit.getAppDataPath(), cmemo_resource.cmemo_dirname ) ) if not os.path.exists(ckit.dataPath()): os.mkdir(ckit.dataPath()) default_config_filename = os.path.join( ckit.getAppExePath(), '_config.py' ) config_filename = os.path.join( ckit.dataPath(), 'config.py' ) cmemo_ini.ini_filename = os.path.join( ckit.dataPath(), 'cmemo.ini' ) # config.py がどこにもない場合は作成する if not os.path.exists(config_filename) and os.path.exists(default_config_filename): shutil.copy( default_config_filename, config_filename ) cmemo_ini.read() ckit.JobQueue.createDefaultQueue()