def _configDirectorySeparator(main_window): items = [] items.append(("スラッシュ : / ", "slash")) items.append(("バックスラッシュ : \\ ", "backslash")) directory_separator = clnch_ini.get("MISC", "directory_separator", "backslash") initial_select = 0 for i in range(len(items)): if items[i][1] == directory_separator: initial_select = i break result = clnch_listwindow.popMenu(main_window, 40, 16, "ディレクトリ区切り文字", items, initial_select) if result < 0: return clnch_ini.set("MISC", "directory_separator", items[result][1]) if items[result][1] == "slash": ckit.setPathSlash(True) else: ckit.setPathSlash(False)
def _configTheme(main_window): def enumThemes(): theme_list = [] theme_parent = os.path.join(ckit.getAppExePath(), 'theme') theme_dir_list = os.listdir(theme_parent) for theme_dir in theme_dir_list: if os.path.exists( os.path.join(theme_parent, theme_dir, "theme.ini")): theme_list.append(theme_dir) return theme_list theme_list = enumThemes() current_theme_name = clnch_ini.get("THEME", "name", "") try: initial_select = theme_list.index(current_theme_name) except: initial_select = 0 result = clnch_listwindow.popMenu(main_window, 40, 16, "テーマ", theme_list, initial_select) if result < 0: return clnch_ini.set("THEME", "name", theme_list[result]) main_window.reloadTheme() return False
def _configTheme(main_window): def enumThemes(): theme_list = [] theme_parent = os.path.join(ckit.getAppExePath(), "theme") theme_dir_list = os.listdir(theme_parent) for theme_dir in theme_dir_list: if os.path.exists(os.path.join(theme_parent, theme_dir, "theme.ini")): theme_list.append(theme_dir) return theme_list theme_list = enumThemes() current_theme_name = clnch_ini.get("THEME", "name", "") try: initial_select = theme_list.index(current_theme_name) except: initial_select = 0 result = clnch_listwindow.popMenu(main_window, 40, 16, "テーマ", theme_list, initial_select) if result < 0: return clnch_ini.set("THEME", "name", theme_list[result]) main_window.reloadTheme() return False
def _configHotKey(main_window): select = 0 while True: items = [] items.append(("ホットキー割り当て", _configHotKeyAssign)) items.append(("ホットキー動作設定", _configHotKeyBehavior)) select = clnch_listwindow.popMenu(main_window, 40, 16, "ホットキー設定", items, select) if select < 0: return items[select][1](main_window)
def _configInput(main_window): select = 0 while True: items = [] items.append(("キー割り当て", _configKeyMap)) items.append(("自動補完", _configAutoComplete)) select = clnch_listwindow.popMenu(main_window, 40, 16, "入力オプション", items, select) if select < 0: return items[select][1](main_window)
def _configFontName(main_window): font_list = main_window.enumFonts() current_font_name = clnch_ini.get("FONT", "name", "") try: initial_select = font_list.index(current_font_name) except: initial_select = 0 result = clnch_listwindow.popMenu(main_window, 40, 16, "フォント", font_list, initial_select) if result < 0: return clnch_ini.set("FONT", "name", font_list[result]) main_window.updateFont()
def _configMinWidth(main_window): width_list = range(12, 81) min_width = clnch_ini.getint("GEOMETRY", "min_width", 18) try: initial_select = width_list.index(min_width) except: initial_select = 0 width_list = list(map(str, width_list)) result = clnch_listwindow.popMenu(main_window, 40, 16, "最小のウインドウサイズ", width_list, initial_select) if result < 0: return clnch_ini.set("GEOMETRY", "min_width", width_list[result])
def _configFontSize(main_window): size_list = range(6, 33) current_font_size = clnch_ini.getint("FONT", "size", 12) try: initial_select = size_list.index(current_font_size) except: initial_select = 0 size_list = list(map(str, size_list)) result = clnch_listwindow.popMenu(main_window, 40, 16, "フォントサイズ", size_list, initial_select) if result < 0: return clnch_ini.set("FONT", "size", size_list[result]) main_window.updateFont()
def _configAutoComplete(main_window): items = [] items.append(("自動補完しない", "0")) items.append(("自動補完する", "1")) auto_complete = clnch_ini.get("MISC", "auto_complete", "1") initial_select = 0 for i in range(len(items)): if items[i][1] == auto_complete: initial_select = i break result = clnch_listwindow.popMenu(main_window, 40, 16, "自動補完", items, initial_select) if result < 0: return clnch_ini.set("MISC", "auto_complete", items[result][1])
def _configHotKeyBehavior(main_window): items = [] items.append(("アクティブ化", "activate")) items.append(("トグル", "toggle")) hotkey_behavior = clnch_ini.get("MISC", "hotkey_behavior", "activate") initial_select = 0 for i in range(len(items)): if items[i][1] == hotkey_behavior: initial_select = i break result = clnch_listwindow.popMenu(main_window, 40, 16, "ホットキー動作設定", items, initial_select) if result < 0: return clnch_ini.set("MISC", "hotkey_behavior", items[result][1]) main_window.updateHotKey()
def _configInactive(main_window): items = [] items.append(("空欄", "empty")) items.append(("時計", "clock")) items.append(("非表示", "hide")) inactive_behavior = clnch_ini.get("MISC", "inactive_behavior", "clock") initial_select = 0 for i in range(len(items)): if items[i][1] == inactive_behavior: initial_select = i break result = clnch_listwindow.popMenu(main_window, 40, 16, "非アクティブ時の動作", items, initial_select) if result < 0: return clnch_ini.set("MISC", "inactive_behavior", items[result][1]) main_window.updateInactiveBehavior()
def _configKeyMap(main_window): items = [] items.append(("101キーボード", "101")) items.append(("106キーボード", "106")) default_keymap = clnch_ini.get("MISC", "default_keymap", "106") initial_select = 0 for i in range(len(items)): if items[i][1] == default_keymap: initial_select = i break result = clnch_listwindow.popMenu(main_window, 40, 16, "キー割り当て", items, initial_select) if result < 0: return clnch_ini.set("MISC", "default_keymap", items[result][1]) main_window.configure()
def doConfigMenu(main_window): select = 0 while True: items = [] items.append(("表示オプション", _configAppearance)) items.append(("入力オプション", _configInput)) items.append(("ホットキー設定", _configHotKey)) items.append(("非アクティブ時の動作", _configInactive)) items.append(("config.py を編集", _editConfigFile)) items.append(("config.py をリロード", _reloadConfigFile)) select = clnch_listwindow.popMenu(main_window, 40, 16, "設定メニュー", items, select) if select < 0: return loop_continue = items[select][1](main_window) if loop_continue == False: return
def _configTopMost(main_window): items = [] items.append(("通常", "0")) items.append(("最前面", "1")) items.append(("最前面のなかの最前面", "2")) topmost = clnch_ini.get("GEOMETRY", "topmost", "0") initial_select = 0 for i in range(len(items)): if items[i][1] == topmost: initial_select = i break result = clnch_listwindow.popMenu(main_window, 40, 16, "ウインドウの最前面表示", items, initial_select) if result < 0: return clnch_ini.set("GEOMETRY", "topmost", items[result][1]) main_window.updateTopMost()
def _configAppearance(main_window): select = 0 while True: items = [] items.append(("テーマ", _configTheme)) items.append(("フォント名", _configFontName)) items.append(("フォントサイズ", _configFontSize)) items.append(("最小の横幅", _configMinWidth)) items.append(("最大の横幅", _configMaxWidth)) items.append(("表示位置の保存", _configPosition)) items.append(("最前面に表示", _configTopMost)) items.append(("ディレクトリ区切り文字", _configDirectorySeparator)) select = clnch_listwindow.popMenu(main_window, 40, 16, "表示オプション", items, select) if select < 0: return loop_continue = items[select][1](main_window) if loop_continue == False: return False