def on_vel_output_browse(self, evnt): current_dir = self.vel_output_dir_bx.GetValue() if current_dir != "" and os.path.isdir(current_dir): prev_dir = current_dir else: try: prev_dir = persist.PersistentStorage().get_value( "prev_velocity_output_dir") except KeyError: prev_dir = "" vel_out_dir = wx.DirSelector( "Select directory for saving velocity arrays", defaultPath=prev_dir) if vel_out_dir == "": return self.vel_output_dir_bx.SetValue(vel_out_dir) persist.PersistentStorage().set_value("prev_velocity_output_dir", vel_out_dir)
def OnScanDir(self, event): dirname = wx.DirSelector(message='Select SGF directory') if not dirname: return added = create_index(dirname) wx.MessageBox('Added %d games.' % added, 'SGF index', wx.OK | wx.ICON_INFORMATION, self)
def change_workspace_path(self, event): # wxGlade: noCLIpseFrame.<event_handler> new_path = "" while not os.path.isdir(new_path): new_path = wx.DirSelector( "Select the workspace directory to scan for existing projects", config.workspace_path) if not new_path: return config.workspace_path = new_path # load projects from this path for dirname in os.listdir(config.workspace_path): path = os.path.join(config.workspace_path, dirname) if os.path.isdir(path): ap = AndroidProject(path + '/AndroidManifest.xml', sdk_dir=config.sdk_path) #Go through the directory and load relevant information tmpproject = { 'name': dirname, 'target': ap.platform, 'path': path, 'activity': '', 'package': ap.name, 'unsaved': False, 'original': None } config.projects.append(tmpproject)
def Show(self): while not os.path.isfile(config.sdk_path + androidpath): print config.sdk_path + androidpath + " does not contain the SDK" new_path = wx.DirSelector( "Select the directory where the Android SDK is installed", homedir) if not new_path: self.Close() break config.sdk_path = new_path print "changing to " + config.sdk_path self.targets_panel.loadTargets() for project in config.projects: project["timestamp"] = time.time() add_project_to_sidebar(project, self.project_list, do_select=False) for libproject in config.libprojects: libproject["timestamp"] = time.time() add_project_to_sidebar(libproject, self.libproject_list, do_select=False) new_project = Generic() new_libproject = Generic() new_project.__dict__.update(empty_project) new_libproject.__dict__.update(empty_libproject) self.project_list.SetClientData(0, new_project) self.libproject_list.SetClientData(0, new_libproject) wx.Frame.Show(self)
def downloadAttachment(self, event): loc = wx.DirSelector(message='Select location to save attachment', parent=self) if not loc: return downloadStatus = self.server.downloadAttachment( self.msgList.GetNextSelected(-1), event.GetIndex(), loc, self.downloadComplete)
def select_source_dir(self, event): # wxGlade: MainFrame.<event_handler> prev_source = os.path.abspath(self.get_source()) if os.path.exists(prev_source) and os.path.isfile(prev_source): # previous source was a file, use its dir as starting point: prev_source = os.path.dirname(prev_source) source_dir = wx.DirSelector( message='Select source folder to be scanned', defaultPath=prev_source) if source_dir: self.set_source(source_dir)
def chooseFolder(prompt, default): """Show a directory chooser dialog. @param prompt Identifier of the dialog title string. @param default The default path. @return The selected path. """ return wx.DirSelector(language.translate(prompt), default)
def onChangePath(self, event): path = wx.DirSelector(_("اختر مجلد التنزيل"), os.path.join(os.getenv("userprofile"), "downloads"), parent=self) # folder select dialog if path == "": return self.changePath.SetLabel( f"{_('مسار مجلد التنزيل: ')} {path}" ) # editing the change path label to show the new path self.path = path
def change_sdk_path(self, event): # wxGlade: noCLIpseFrame.<event_handler> new_path = "" while not os.path.isfile(new_path + androidpath): new_path = wx.DirSelector( "Select the directory where the Android SDK is installed", config.sdk_path) if not new_path: return config.sdk_path = new_path self.targets_panel.loadTargets()