コード例 #1
0
    def renew_config_file(self):
        new_ramdisk_setting = self.get_ramdisk_setting_from_input()
        if self.control_type == ControlCfgType.add:
            self.cfg_data.append(new_ramdisk_setting)
        else:
            self.cfg_data[self.ramdisk_setting_index] = new_ramdisk_setting

        cfg_h = utils.JsonControl(self.cfg_filename)
        cfg_h.write_json(self.cfg_data)
コード例 #2
0
    def init_cfg_listctrl(self):
        self.ramdrive_listctrl.ClearAll()
        self.ramdrive_listctrl.InsertColumn(0,
                                            'ID',
                                            format=wx.LIST_FORMAT_CENTRE)
        self.ramdrive_listctrl.InsertColumn(1,
                                            'Drive',
                                            format=wx.LIST_FORMAT_CENTRE)
        self.ramdrive_listctrl.InsertColumn(2,
                                            'Size',
                                            format=wx.LIST_FORMAT_CENTRE)
        self.ramdrive_listctrl.InsertColumn(3,
                                            'Label',
                                            format=wx.LIST_FORMAT_CENTRE)
        self.ramdrive_listctrl.InsertColumn(4,
                                            'Store Image?',
                                            format=wx.LIST_FORMAT_CENTRE)
        self.ramdrive_listctrl.InsertColumn(5,
                                            'Store Full Image?',
                                            format=wx.LIST_FORMAT_CENTRE)
        self.ramdrive_listctrl.InsertColumn(6,
                                            'Image path',
                                            format=wx.LIST_FORMAT_CENTRE)

        cfg_h = utils.JsonControl(settings.CONFIG_FILENAME)
        self.cfg_data = cfg_h.read_json()

        item_index = 0
        for ramdisk_cfg in self.cfg_data:
            index = self.ramdrive_listctrl.InsertItem(
                item_index, ramdisk_cfg[RamDIskCfg.ID.value])
            self.ramdrive_listctrl.SetItem(
                index, 1, ramdisk_cfg[RamDIskCfg.DRIVE.value] + ":")
            self.ramdrive_listctrl.SetItem(
                index, 2, str(ramdisk_cfg[RamDIskCfg.SIZE.value]))
            self.ramdrive_listctrl.SetItem(index, 3,
                                           ramdisk_cfg[RamDIskCfg.LABEL.value])

            self.ramdrive_listctrl.SetItem(
                index, 4,
                self.bool_to_str(ramdisk_cfg[RamDIskCfg.STORE_IMG.value]))
            self.ramdrive_listctrl.SetItem(
                index, 5,
                self.bool_to_str(ramdisk_cfg[RamDIskCfg.STORE_ALL.value]))
            self.ramdrive_listctrl.SetItem(
                index, 6, ramdisk_cfg[RamDIskCfg.IMG_PATH.value])
            # self.ramdrive_listctrl.SetItem(index, 7, ramdisk_cfg[RamDIskCfg.STORE_FOLDER_LIST.value])

            item_index += 1

        for i in range(0, 7):
            self.ramdrive_listctrl.SetColumnWidth(i,
                                                  wx.LIST_AUTOSIZE_USEHEADER)

        self.ramdrive_listctrl.Select(0)
コード例 #3
0
ファイル: main.py プロジェクト: Llona/hotkey
    def save_to_cfg(self, event=None):
        gui_hotkey_list = self.get_gui_hotkey_list()
        new_hotkey_data = self.config_data.copy()
        new_hotkey_data[CfgKeyEnum.hot_key.value] = OrderedDict()
        for hotkey in gui_hotkey_list:
            new_hotkey_data[CfgKeyEnum.hot_key.value][
                hotkey] = self.config_data[CfgKeyEnum.hot_key.value][hotkey]

        json_h = utils.JsonControl(self.cfg_file_path)
        json_h.write_config(new_hotkey_data)
        self.__close_frame()
コード例 #4
0
ファイル: main.py プロジェクト: Llona/hotkey
def start_cmd():
    # joytokey_cfg = settings.JoyToKeyCfg_dic[settings.KEY_GROUP]
    # key_group = settings.KEY_GROUP
    json_h = utils.JsonControl(settings.DEFAULT_CONFIG_NAME)
    json_h = json_h.read_config()

    hotkey_cfg = remove_comment_from_cfg(json_h['hot_key'])

    run_joy_to_key = utils.RunJoyToKey(settings.ini_full_path,
                                       settings.exec_full_path,
                                       json_h['joy_to_key'])
    run_joy_to_key.re_run_joy_to_key()

    code_sender = key_scan_code_sender.ScanCodeSender()
    hot_key = HotKey(code_sender, thread_queue)
    hot_key.regist_hotkey(hotkey_cfg)
コード例 #5
0
def start_cmd():
    # joytokey_cfg = settings.JoyToKeyCfg_dic[settings.KEY_GROUP]
    # key_group = settings.KEY_GROUP

    json_h = utils.JsonControl(
        os.path.join(sys.path[0], settings.DEFAULT_CONFIG_NAME))
    json_h = json_h.read_config()

    thread_queue = queue.Queue()
    run_joy_to_key = utils.RunJoyToKey(settings.ini_full_path,
                                       settings.exec_full_path,
                                       json_h['joy_to_key'])
    run_joy_to_key.re_run_joy_to_key()

    hot_key = HotKey(thread_queue)
    hot_key.regist_hotkey(json_h['hot_key'])

    check_foreground = utils.CheckWindowsIsForeground(
        settings.FOREGROUND_TITLE)
コード例 #6
0
ファイル: main.py プロジェクト: Llona/hotkey
 def save_change_to_cfg(self):
     json_h = utils.JsonControl(self.cfg_file_path)
     json_h.write_config(self.config_data)
コード例 #7
0
ファイル: main.py プロジェクト: Llona/hotkey
 def get_key_config(self):
     cfg_h = utils.JsonControl(self.cfg_file_path)
     return cfg_h.read_config()
コード例 #8
0
 def get_key_config():
     cfg_h = utils.JsonControl(
         os.path.join(sys.path[0], settings.DEFAULT_CONFIG_NAME))
     return cfg_h.read_config()