示例#1
0
	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 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)
示例#3
0
    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()
示例#4
0
    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()