20
20
__links__ = {
21
21
'discord' : 'https://discord.gg/eRVfbgwNku' ,
22
22
'releases' : 'https://github.com/wmw-modding/wheres-my-editor/releases/latest' ,
23
+ 'bugs' : 'https://github.com/wmw-modding/wheres-my-editor/issues' ,
23
24
}
24
25
25
26
__min_wmwpy_version__ = "0.5.0-beta"
@@ -149,8 +150,36 @@ def __init__(self, parent):
149
150
self .updateSettings ()
150
151
151
152
self .selection_rect = None
152
-
153
+
154
+ self .panedGrip : dict [typing .Literal ['image' , 'horizontal' , 'vertical' ], Image .Image | ImageTk .PhotoImage ] = {
155
+ 'image' : Image .open (self .getAsset ('assets/images/grip.gif' )).convert ('RGBA' ),
156
+ }
157
+
158
+ self .panedGrip ['horizontal' ] = ImageTk .PhotoImage (self .panedGrip ['image' ])
159
+ self .panedGrip ['vertical' ] = ImageTk .PhotoImage (self .panedGrip ['image' ].rotate (90 , expand = True ))
160
+
153
161
self .style = ttk .Style ()
162
+ # self.style.theme_use('clam')
163
+
164
+ self .style .element_create ("Sash.Horizontal" , "image" , self .panedGrip ['horizontal' ], sticky = 'we' )
165
+ self .style .layout ("Horizontal.TPanedWindow" , [('Sash.Horizontal' , {})])
166
+
167
+ self .style .element_create ("Sash.Vertical" , "image" , self .panedGrip ['vertical' ], sticky = 'ns' )
168
+ self .style .layout ("Vertical.TPanedWindow" , [('Sash.Vertical' , {})])
169
+
170
+ # self.style.layout("Clicked.TPanedWindow", [('Sash.xsash', {})])
171
+
172
+ self .style .configure ('TPanedwindow' , opaqueresize = False )
173
+ # self.style.configure('Clicked.TPanedwindow', background='blue')
174
+ self .style .configure ('Sash' , sashthickness = 5 )
175
+
176
+ # ttk.PanedWindow(orient='horizontal').cget('orient')
177
+
178
+ # self.bind_class('TPanedwindow', '<Button-1>', lambda e : print(e.widget.configure(style = 'Clicked.TPanedwindow')))
179
+ # self.bind_class('TPanedwindow', '<B1-Motion>', lambda e : e.widget.tk.call(e.widget, "sash", 0, (e.x if str(e.widget["orient"]) == "horizontal" else e.y)))
180
+ # self.bind_class('TPanedwindow', '<ButtonRelease-1>', lambda e : e.widget.configure(style = 'TPanedwindow'))
181
+ # self.bind_class('Sash.TPanedWindow', '<Leave>', lambda e : e.widget.configure(style = 'TPanedwindow'))
182
+ # self.bind_class('Sash.TPanedWindow', '<Enter>', lambda e : e.widget.configure(style = 'Clicked.TPanedwindow'))
154
183
155
184
self .active = True
156
185
@@ -189,11 +218,11 @@ def findIcons(self):
189
218
return self .windowIcons
190
219
191
220
def createWindow (self ):
192
- self .seperator = ttk .PanedWindow (orient = 'horizontal' )
193
- self .seperator .pack (fill = tk .BOTH , expand = 1 )
221
+ self .separator = ttk .PanedWindow (orient = 'horizontal' , style = 'Horizontal.TPanedWindow ' )
222
+ self .separator .pack (fill = tk .BOTH , expand = 1 )
194
223
195
- self .side_pane = ttk .PanedWindow (self .seperator , orient = 'vertical' )
196
- self .seperator .add (self .side_pane )
224
+ self .side_pane = ttk .PanedWindow (self .separator , orient = 'vertical' , style = "Vertical.TPanedWindow" )
225
+ self .separator .add (self .side_pane )
197
226
198
227
side_pane_width = 250
199
228
side_pane_height = 300
@@ -203,7 +232,7 @@ def createWindow(self):
203
232
204
233
self .object_selector : dict [typing .Literal [
205
234
'labelFrame' ,
206
- 'treeviewe ' ,
235
+ 'treeview ' ,
207
236
'y_scroll' ,
208
237
'x_scroll' ,
209
238
], tk .Widget | ttk .Treeview ] = {
@@ -259,8 +288,8 @@ def createWindow(self):
259
288
self .properties ['scrollFrame' ].pack (fill = 'both' , expand = True )
260
289
self .properties ['frame' ] = self .properties ['scrollFrame' ].viewPort
261
290
262
- self .level_canvas = tk .Canvas (self .seperator , width = 90 * self .scale , height = 120 * self .scale )
263
- self .seperator .add (self .level_canvas , weight = 1 )
291
+ self .level_canvas = tk .Canvas (self .separator , width = 90 * self .scale , height = 120 * self .scale )
292
+ self .separator .add (self .level_canvas , weight = 1 )
264
293
265
294
self .level_images = {
266
295
'background' : self .level_canvas .create_image (
@@ -373,7 +402,7 @@ def disableWindow(self):
373
402
self .menubar .entryconfig (item + 1 , state = 'disabled' )
374
403
375
404
def bindKeyboardShortcuts (self , * args ):
376
- logging .debug ('Binding keyboard shotcuts ' )
405
+ logging .debug ('Binding keyboard shortcuts ' )
377
406
378
407
self .bind (f'<{ crossplatform .modifier ()} -v>' , self .pasteObject )
379
408
self .bind (f'<{ crossplatform .modifier ()} -c>' , self .copyObject )
@@ -401,7 +430,7 @@ def bindKeyboardShortcuts(self, *args):
401
430
self .bind (f'<Shift-Right>' , lambda * args : self .moveObject (amount = (4 ,0 )))
402
431
403
432
def unbindKeyboardShortcuts (self , * args ):
404
- logging .debug ('unbinding keyboard shotcuts ' )
433
+ logging .debug ('unbinding keyboard shortcuts ' )
405
434
406
435
self .unbind (f'<{ crossplatform .modifier ()} -v>' )
407
436
self .unbind (f'<{ crossplatform .modifier ()} -c>' )
@@ -484,7 +513,7 @@ def state(self, state : typing.Literal['enabled', 'normal', 'disabled']):
484
513
if state == 'enabled' :
485
514
state = 'normal'
486
515
elif state not in ['enabled' , 'normal' , 'disabled' ]:
487
- raise ValueError (f'uknown state { state } ' )
516
+ raise ValueError (f'unknown state { state } ' )
488
517
489
518
self ._state = state
490
519
@@ -1017,7 +1046,7 @@ def inputType(type, value):
1017
1046
for t in type :
1018
1047
t = t .lower ()
1019
1048
input , var = inputType (t , value [column ])
1020
- input .grid (column = column , row = row , sticky = 'ew' )
1049
+ input .grid (column = column , row = row , sticky = 'ew' , padx = 2 )
1021
1050
if callable (entry_callback ):
1022
1051
var .trace ('w' , lambda * args , value = var .get , col = column : entry_callback (value (), col ))
1023
1052
@@ -1038,7 +1067,7 @@ def inputType(type, value):
1038
1067
type = type .lower ()
1039
1068
1040
1069
input , var = inputType (type , value )
1041
- input .grid (column = 0 , row = row , sticky = 'ew' , columnspan = 2 )
1070
+ input .grid (column = 0 , row = row , sticky = 'ew' , columnspan = 2 , padx = 2 )
1042
1071
1043
1072
if entry_callback :
1044
1073
var .trace ('w' , lambda * args : entry_callback (var .get ()))
@@ -1082,7 +1111,7 @@ def inputType(type, value):
1082
1111
'var' : vars ,
1083
1112
}
1084
1113
1085
- def removePropety (property ):
1114
+ def removeProperty (property ):
1086
1115
if property in obj .properties :
1087
1116
del obj .properties [property ]
1088
1117
self .updateObject (obj )
@@ -1188,7 +1217,7 @@ def updatePosition(value, column):
1188
1217
logging .debug (f'{ property = } ' )
1189
1218
prefix = ''
1190
1219
button_text = '-'
1191
- button_callback = lambda * args , prop = property : removePropety (prop )
1220
+ button_callback = lambda * args , prop = property : removeProperty (prop )
1192
1221
1193
1222
if property in obj .defaultProperties :
1194
1223
prefix = '*'
@@ -1272,7 +1301,8 @@ def resetProperties(self):
1272
1301
if not 'panned' in self .properties :
1273
1302
self .properties ['panned' ] = ttk .PanedWindow (
1274
1303
self .properties ['frame' ],
1275
- orient = 'horizontal'
1304
+ orient = 'horizontal' ,
1305
+ style = 'Horizontal.TPanedWindow'
1276
1306
)
1277
1307
self .properties ['panned' ].pack (expand = True , fill = 'both' )
1278
1308
@@ -1464,6 +1494,8 @@ def createMenubar(self):
1464
1494
self .help_menu .add_command (label = 'Discord' , command = lambda * args : webbrowser .open (__links__ ['discord' ]))
1465
1495
self .help_menu .add_command (label = 'About' , command = self .showAbout )
1466
1496
self .help_menu .add_command (label = 'Check for update' , command = lambda * args : webbrowser .open (__links__ ['releases' ]))
1497
+ self .help_menu .add_command (label = 'Bug report' , command = lambda * args : webbrowser .open (__links__ ['bugs' ]))
1498
+ self .help_menu .add_command (label = 'Open log' , command = lambda * args : crossplatform .open_file (_log_filename ))
1467
1499
1468
1500
self .menubar .add_cascade (label = 'Help' , menu = self .help_menu )
1469
1501
0 commit comments