def show_modal(self):
     path = None
     if self.dir_mode:
         self.result = fsui.pick_directory(
             parent=self.parent,
             message=self.title,
             directory=self.directory,
         )
         if self.result:
             path = self.result
     elif self.multiple:
         self.result = fsui.pick_files(
             parent=self.parent,
             message=self.title,
             directory=self.directory,
         )
         if self.result:
             path = self.result[0]
     else:
         self.result = fsui.pick_file(
             parent=self.parent,
             message=self.title,
             directory=self.directory,
         )
         if self.result:
             path = self.result
     if path:
         last_path_dir = os.path.dirname(path)
         LauncherSettings.set(self.settings_key, last_path_dir)
     return bool(self.result)
Exemplo n.º 2
0
 def show_modal(self):
     path = None
     if self.dir_mode:
         self.result = fsui.pick_directory(
             parent=self.parent,
             message=self.title,
             directory=self.directory,
         )
         if self.result:
             path = self.result
     elif self.multiple:
         self.result = fsui.pick_files(
             parent=self.parent,
             message=self.title,
             directory=self.directory,
         )
         if self.result:
             path = self.result[0]
     else:
         self.result = fsui.pick_file(
             parent=self.parent,
             message=self.title,
             directory=self.directory,
         )
         if self.result:
             path = self.result
     if path:
         last_path_dir = os.path.dirname(path)
         LauncherSettings.set(self.settings_key, last_path_dir)
     return bool(self.result)
Exemplo n.º 3
0
 def on_add_button(self):
     search_path = LauncherSettings.get("search_path")
     search_path = [x.strip() for x in search_path.split(";") if x.strip()]
     path = fsui.pick_directory(parent=self.get_window())
     if path:
         for i in range(len(search_path)):
             if search_path[i].startswith("-"):
                 if path == search_path[i][1:]:
                     search_path.remove(search_path[i])
                     break
             else:
                 if search_path[i] == path:
                     # Already added.
                     break
         else:
             default_paths = FSGSDirectories.get_default_search_path()
             if path not in default_paths:
                 search_path.append(path)
         LauncherSettings.set("search_path", ";".join(search_path))
 def on_browse(self):
     path = fsui.pick_directory(self.get_window(),
                                gettext("Select Source Directory"))
     if path:
         self.set_path(path)
Exemplo n.º 5
0
 def on_browse(self):
     path = fsui.pick_directory(
         self.get_window(), gettext("Select Source Directory")
     )
     if path:
         self.set_path(path)