Skip to content

Commit 3a811f7

Browse files
committed
Fixed Drag-and-Drop for unusual paths
1 parent fddfa6a commit 3a811f7

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

topasgraphsim/src/classes/main_viewer.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ def add_file(self, path):
3232
self.tabview.tab(self.tabview.tabnames[self.tabview.tabnames.index(self.tabview.get())]).tab.options.load_measurement(path)
3333

3434
def drop(self, event):
35-
path = event.data
36-
if "{" in path and "}" in path:
37-
path = path[1:-1]
38-
if len(self.tabview.tabnames) == 0:
39-
self.tabview.add_tab(name = True)
40-
if path[-4:] == ".csv":
41-
self.tabview.tab(self.tabview.tabnames[-1]).tab.options.load_topas(path)
42-
elif path[-4:] == ".mcc":
43-
self.tabview.tab(self.tabview.tabnames[-1]).tab.options.load_measurement(path)
44-
35+
if "}" in event.data:
36+
paths = event.data.split("}")
4537
else:
46-
if path[-4:] == ".csv":
47-
self.tabview.tab(self.tabview.tabnames[self.tabview.tabnames.index(self.tabview.get())]).tab.options.load_topas(path)
48-
elif path[-4:] == ".mcc":
49-
self.tabview.tab(self.tabview.tabnames[self.tabview.tabnames.index(self.tabview.get())]).tab.options.load_measurement(path)
38+
paths = event.data.split(" ")
39+
for path in paths:
40+
if path != "":
41+
path = path.strip()
42+
if "{" in path:
43+
path = path.replace("{", "")
44+
if path[-4:] == ".csv":
45+
if len(self.tabview.tabnames) == 0:
46+
self.tabview.add_tab(name = True)
47+
self.tabview.tab(self.tabview.tabnames[-1]).tab.options.load_topas(path)
48+
elif path[-4:] == ".mcc":
49+
if len(self.tabview.tabnames) == 0:
50+
self.tabview.add_tab(name = True)
51+
self.tabview.tab(self.tabview.tabnames[-1]).tab.options.load_measurement(path)

topasgraphsim/src/resources/profile.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geometry": "960x540+208+208",
2+
"geometry": "960x540+182+182",
33
"state": "normal",
44
"draganddrop": true,
55
"color_scheme": "light",

0 commit comments

Comments
 (0)