def do_new_dir(self): say("Doing request_new_directory") result = FileDialogs.request_new_directory( "Create Sparkling New Directory:", default_dir=last_dir, default_name=last_name) self.save_result(result)
def choose_key_file(self): global last_dir result = FileDialogs.request_old_file("Open SSH key File:", default_dir = last_dir, file_types = file_types) if isinstance(result, FileRef): last_dir = result.dir self.txt_key_file.text = result.path
def do_old_files(self): say("Doing request_old_files") if self.filt.on: file_types = [self.file_type] else: file_types = None result = FileDialogs.request_old_files("Open Dusty Old Files:", default_dir = last_dir, file_types = file_types) self.save_result(result)
def choose_key_file(self): global last_dir result = FileDialogs.request_old_file("Open SSH key File:", default_dir=last_dir, file_types=file_types) if isinstance(result, FileRef): last_dir = result.dir self.txt_key_file.text = result.path
def do_new_file(self): say("Doing request_new_file with default_dir = %s, default_name = %r" % (last_dir, last_name)) if self.filt.on: file_type = self.file_type else: file_type = None result = FileDialogs.request_new_file("Save Shiny New File:", default_dir = last_dir, default_name = last_name, file_type = file_type) self.save_result(result)
def choose_local_file(self): global last_dir try: result = FileDialogs.request_old_file("Open Local File:", default_dir = last_dir, file_types = file_types) if isinstance(result, FileRef): last_dir = result.dir self.txt_local_file.text = result.path except: logging.getLogger('term_pygui').exception('unable to choose file')
def process_status_cmd(self, context): if not 'ACTION' in context: logging.getLogger('term_pygui').warn( 'action not found in status cmd') return action = context['ACTION'].upper() home = context['HOME'] pwd = context['PWD'] r_f = context['R_F'] global last_dir l_f = None result = None base_name = os.path.basename(r_f) if action == 'UPLOAD': result = FileDialogs.request_old_file("Choose file to upload:", default_dir=last_dir, file_types=file_types) elif action == 'DOWNLOAD': result = FileDialogs.request_new_file( "Choose location to save download file:", default_dir=last_dir, default_name=base_name) else: logging.getLogger('term_pygui').warn( 'action not valid:{} in status cmd'.format(action)) return if not isinstance(result, FileRef): return last_dir = result.dir l_f = result.path dlg = FileTransferProgressDialog(self.session, l_f, r_f, home, pwd, action == 'UPLOAD') dlg.present()
def process_status_cmd(self, context): if not 'ACTION' in context: logging.getLogger('term_pygui').warn('action not found in status cmd') return action = context['ACTION'].upper() home = context['HOME'] pwd = context['PWD'] r_f = context['R_F'] global last_dir l_f = None result = None base_name = os.path.basename(r_f) if action == 'UPLOAD': result = FileDialogs.request_old_file("Choose file to upload:", default_dir = last_dir, file_types = file_types) elif action == 'DOWNLOAD': result = FileDialogs.request_new_file("Choose location to save download file:", default_dir = last_dir, default_name = base_name) else: logging.getLogger('term_pygui').warn('action not valid:{} in status cmd'.format(action)) return if not isinstance(result, FileRef): return last_dir = result.dir l_f = result.path dlg = FileTransferProgressDialog(self.session, l_f, r_f, home, pwd, action == 'UPLOAD') dlg.present()
def do_old_dirs(self): say("Doing request_old_directories") result = FileDialogs.request_old_directories("Open Mouldy Old Directories:", default_dir = last_dir) self.save_result(result)
from GUI import View, Button, FileDialogs, Label, Font
def do_new_dir(self): say("Doing request_new_directory") result = FileDialogs.request_new_directory("Create Sparkling New Directory:", default_dir = last_dir, default_name = last_name) self.save_result(result)