def _toggle_hidden_files(pane, value): if value: pane._remove_filter(_hidden_file_filter) else: pane._add_filter(_hidden_file_filter) _get_pane_info(pane)['show_hidden_files'] = value save_json('Panes.json')
def _GetScriptVars(): # # Get the scripts directory. # scriptVars = load_json("LaunchScript.json") if scriptVars is None: scriptVars = dict() scriptVars['show_output'] = True scriptVars['directory'] = os.path.expanduser('~/bin') scriptVars['local_shell'] = os.path.expanduser('~/.bashrc') scriptVars['command_line_history'] = ['ls -la'] save_json("LaunchScript.json", scriptVars) return(scriptVars)
def _get_default_recipient(self): config = load_json(CONFIG_FILE_NAME, default={}) if config and "default_recipient" in config: return config["default_recipient"] else: default_recipient, ok = show_prompt( 'First run - please enter default recipient') config['default_recipient'] = default_recipient save_json(CONFIG_FILE_NAME, config) return default_recipient
def _get_foobar2000_exe_path(self): config = load_json(CONFIG_FILE_NAME, default={}) if config and "foobar2000_exe_path" in config: return config["foobar2000_exe_path"] selected_foobar2000_exe_path = show_file_open_dialog("First use configuration: Please locate your foobar2000 executable.", DEFAULT_FOOBAR2000_EXECUTABLE_PATH, "*.exe") if selected_foobar2000_exe_path: config['foobar2000_exe_path'] = selected_foobar2000_exe_path save_json(CONFIG_FILE_NAME, config) return selected_foobar2000_exe_path return None
def set_tortoisesvnproc_install_path(): new_tortoisesvnproc_filepath, ok = show_prompt( 'Enter full path to TortoiseSVNProc.exe program here', default=get_current_tortoisesvnproc_install_path(), selection_start=0, selection_end=None) if not ok: return False if not exists(as_url(new_tortoisesvnproc_filepath)): show_alert('Path to TortoiseSVNProc given is invalid') return False _TORTOISEPROCPATH = new_tortoisesvnproc_filepath save_json(_TORTOISEPROCCONFIGFILE, {'path': new_tortoisesvnproc_filepath}) return True
def set_sublime_install_path(): new_sublime_filepath, ok = show_prompt( 'Enter full path to Sublime Text program here', default=get_current_sublime_install_path(), selection_start=0, selection_end=None) if not ok: return False if not exists(as_url(new_sublime_filepath)): show_alert('Path to Sublime Text given is invalid') return False _SUBLIMETEXTPATH = new_sublime_filepath save_json(_SUBLIMETEXTCONFIGFILE, {'path': new_sublime_filepath}) return True
def __call__(self): selected_files = self.pane.get_selected_files() if len(selected_files) >= 1 or (len(selected_files) == 0 and self.get_chosen_files()): if len(selected_files) == 0 and self.get_chosen_files(): selected_files.append(self.get_chosen_files()[0]) file = as_human_readable(selected_files[0]) if(os.path.exists(file)): contents = '' npdata = load_json('CopyToNotePad.json') if npdata is None: npdata = dict() npdata['number'] = 3 npdata['save'] = 'a' save_json('CopyToNotePad.json', npdata) with open(file, 'r') as content_file: contents = content_file.read() headers = {'Content-Type': 'application/json'} requests.put('http://localhost:9978/api/note/' + str(npdata['number']) + '/' + npdata['save'], headers=headers, data=json.dumps({"note": contents}))
def __call__(self): global DBDATA show_status_message('NotePad (A)ppend or Over(w)rite') npdata = load_json('CopyToNotePad.json') if npdata is None: npdata = dict() npdata['number'] = 3 npdata['save'] = 'a' npappend, result = show_prompt( "The 'a'ppend or 'w'rite:") if not npappend: npappend = 'a' npappend = npappend.lower() if (npappend != 'a') and (npappend != 'w'): npappend = 'a' npdata['save'] = npappend save_json('CopyToNotePad.json', npdata) clear_status_message()
def __call__(self): global DBDATA show_status_message('NotePad Number') npdata = load_json('CopyToNotePad.json') if npdata is None: npdata = dict() npdata['number'] = 3 npdata['save'] = 'a' npnum, result = show_prompt( "The NotePad Number to use:") if not npnum: npnum = 3 else: npnum = int(npnum) if npnum < 1: npnum = 1 elif npnum > 9: npnum = 9 npdata['number'] = npnum save_json('CopyToNotePad.json', npdata) clear_status_message()
def _save_comparison_tool(self, tool_path: str): save_json(_SETTINGS_FILE, {_COMPAISON_TOOL_KEY: tool_path})
def load_config() -> dict: config = load_json(CONFIG_FILE) if config is None: config = {"bin": find_code(), "additionalArgs": []} save_json(CONFIG_FILE, config) return config
def _SaveScriptVars(scriptVars): save_json("LaunchScript.json", scriptVars)
def saveConfig(cls, save_data): save_json('StatusBarExtended.json', save_data)