Skip to content

Commit 3e59e6f

Browse files
author
piotrj
committed
drag & drop event binding (main window, new record window)
pyinstaller, nuitka update release & distros rename
1 parent 3cc4943 commit 3e59e6f

File tree

3 files changed

+42
-10
lines changed

3 files changed

+42
-10
lines changed

.github/workflows/run.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,12 @@ jobs:
258258
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
259259
with:
260260
tag_name: ${{ steps.version.outputs.version }}
261-
name: librer Release ${{ steps.version.outputs.version }}
261+
name: Librer ${{ steps.version.outputs.version }}
262262
draft: false
263263
prerelease: false
264264
files: |
265-
librer.${{ steps.version.outputs.version }}.portable.linux.zip
266-
librer.${{ steps.version.outputs.version }}.portable.linux.nuitka.zip
267-
librer.${{ steps.version.outputs.version }}.portable.windows.zip
268-
librer.${{ steps.version.outputs.version }}.portable.windows.nuitka.zip
269-
265+
librer.${{ steps.version.outputs.version }}.linux.portable.zip
266+
librer.${{ steps.version.outputs.version }}.linux.nuitka.portable.zip
267+
librer.${{ steps.version.outputs.version }}.windows.portable.zip
268+
librer.${{ steps.version.outputs.version }}.windows.nuitka.portable.zip
270269

requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
pyinstaller==6.5.0
1+
pyinstaller==6.6.0
22
send2trash==1.8.2
33
zstandard==0.22.0
44
psutil==5.9.8
55
pympler==1.0.1
66
ciso8601==2.3.1
77
pywin32==306; sys.platform == 'win32'
8-
nuitka==2.1.2
8+
nuitka==2.1.5
9+
tkinterdnd2==0.3.0

src/librer.py

+34-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
####################################################################################
2828

2929
from os import sep,system,getcwd,name as os_name,cpu_count
30-
from os.path import abspath,normpath,dirname,join as path_join,isfile as path_isfile
30+
from os.path import abspath,normpath,dirname,join as path_join,isfile as path_isfile,exists as path_exists,isdir
3131
from gc import disable as gc_disable, enable as gc_enable,collect as gc_collect,set_threshold as gc_set_threshold, get_threshold as gc_get_threshold
3232

3333
from pathlib import Path
@@ -37,6 +37,9 @@
3737
from tkinter import Tk,Toplevel,PhotoImage,Menu,Label,LabelFrame,Frame,StringVar,BooleanVar,IntVar
3838
from tkinter.ttk import Treeview,Checkbutton,Radiobutton,Scrollbar,Button,Menubutton,Entry,Scale,Style
3939
from tkinter.filedialog import askdirectory,asksaveasfilename,askopenfilename,askopenfilenames
40+
41+
from tkinterdnd2 import DND_FILES, TkinterDnD
42+
4043
from threading import Thread
4144
from traceback import format_stack
4245
import sys
@@ -348,7 +351,11 @@ def __init__(self,cwd):
348351

349352
self.main_locked_by_child=None
350353
####################################################################
351-
self_main = self.main = Tk()
354+
#self_main = self.main = Tk()
355+
self_main = self.main = TkinterDnD.Tk()
356+
357+
self_main.drop_target_register(DND_FILES)
358+
self_main.dnd_bind('<<Drop>>', lambda e: self.main_drop(e.data) )
352359

353360
self.main_config = self.main.config
354361

@@ -929,6 +936,28 @@ def help_cascade_post():
929936

930937
self_main.mainloop()
931938

939+
def main_drop(self, data):
940+
dialog = self.get_scan_dialog()
941+
self.path_to_scan_entry_var.set(data)
942+
self.scan_label_entry_var.set("dropped_path")
943+
944+
self.main.after_idle(lambda : self.scan_dialog_show())
945+
946+
def scan_dialog_drop(self, data):
947+
if paths := self.main.splitlist(data):
948+
path = paths[0]
949+
p_path = normpath(abspath(path))
950+
951+
self.scan_label_entry_var.set("dropped_path")
952+
953+
if path_exists(p_path):
954+
if isdir(p_path):
955+
self.path_to_scan_entry_var.set(p_path)
956+
else:
957+
self.path_to_scan_entry_var.set(dirname(p_path))
958+
else:
959+
self.get_info_dialog_on_scan().show('Path does not exist',str(p_path))
960+
932961
def tree_focus_out(self):
933962
tree = self.tree
934963
item=tree.focus()
@@ -1128,6 +1157,9 @@ def get_scan_dialog(self):
11281157

11291158
self.scan_dialog=dialog=GenericDialog(self.main,(self.ico_record_new,self.ico_record_new),self.bg_color,'---',pre_show=self.pre_show,post_close=self.post_close,min_width=800,min_height=550)
11301159

1160+
dialog.area_main.drop_target_register(DND_FILES)
1161+
dialog.area_main.dnd_bind('<<Drop>>', lambda e: self.scan_dialog_drop(e.data) )
1162+
11311163
self_ico = self.ico
11321164

11331165
#self.log_skipped_var=BooleanVar()

0 commit comments

Comments
 (0)