Skip to content

Commit

Permalink
ADDED: Dropping from other file managers + safety lock is_focused +…
Browse files Browse the repository at this point in the history
… TODO

(other file managers not meaning other instances of tuifi!)
  • Loading branch information
GiorgosXou committed Apr 23, 2024
1 parent 32e8a37 commit 615decb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions TUIFIManager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,15 @@ def __get_selected_files(self): # I know it's not optimized at all, but ... anyw
return [QUrl.fromLocalFile(self.directory + sep + self.__pre_pressed_file.name)]


def handle_gui_to_tui_dropped_file(self, file_url, type): #TODO: Custom user actions on link patterns: eg. clone git, save at folder xy, etc.
def handle_gui_to_tui_dropped_file(self, file_url, type): #TODO: Custom user actions on link patterns: eg. clone git, save at folder xy, etc. + TODO: if dropped on folder
self.is_focused = False
self.__set_label_text(f'DROPPED: {file_url}')
if type == 1:
self.__set_label_text("It's on the todo list :P") #TODO: handle files
name = os.path.basename(file_url)
shutil.move(file_url, self.directory + sep + name)
self.__sub_handle_creation_of(name, self.get_profile(file_url)) # TODO: for other non \file_extensions
self.__set_label_text(f'MOVED: {name}')
self.refresh() #for some reason refresh is needed that's SuS. Should look on download too
elif type == 0:
self.download(file_url, self.directory + sep)
elif file_url.startswith('data:') and not file_url.find('base64') == -1:
Expand All @@ -568,7 +573,7 @@ def handle_gui_to_tui_dropped_file(self, file_url, type): #TODO: Custom user act
self.save(self.directory, filename, base64.b64decode(file_url[file_url.find('4')+1:])) # 4 is from base64
else:
self.__set_label_text(f'DROPPED UNHANDLED: {file_url}')

self.is_focused = True
# r = requests.get(file_url) # , stream=True
# r.headers.get('filename')
# unicurses.mvwaddwstr(self.pad,0,0,f'is downloadable: {r.headers}')
Expand Down

0 comments on commit 615decb

Please sign in to comment.