Skip to content

Commit

Permalink
default properties can't be renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
ego-lay-atman-bay committed May 23, 2023
1 parent 6e3e350 commit e71b16b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def createWindow(self):

self.properties : dict[typing.Literal[
'labelFrame',
'notebook',
'scrollFrame',
'frame',
'panned',
Expand All @@ -231,7 +232,12 @@ def createWindow(self):
}
self.side_pane.add(self.properties['labelFrame'])

# self.properties['notebook'] = ttk.Notebook(self.properties['labelFrame'])

self.properties['scrollFrame'] = ScrollFrame(self.properties['labelFrame'], usettk=True, width=side_pane_width,)
# self.properties['notebook'].pack(fill='both', expand=True)
# self.properties['notebook'].add(self.properties['scrollFrame'], text='Object Properties')
# self.properties['notebook'].add(ttk.Frame(self.properties['notebook']), text='Level Properties')
self.properties['scrollFrame'].pack(fill='both', expand=True)
self.properties['frame'] = self.properties['scrollFrame'].viewPort

Expand Down Expand Up @@ -609,6 +615,7 @@ def addProperty(
show_button = True,
row = 0,
label_prefix : str = '',
label_editable : bool = True,
entry_callback : typing.Callable[[str], typing.Any] = None,
label_callback : typing.Callable[[str], bool] = None,
button_callback : typing.Callable = None,
Expand All @@ -624,7 +631,7 @@ def addProperty(

label_frame = ttk.Frame(self.properties['left'])

if show_button:
if label_editable:
name = tkwidgets.EditableLabel(
label_frame,
text = property,
Expand Down Expand Up @@ -791,6 +798,7 @@ def updatePosition(value, column):
'Name',
obj.name,
'text',
label_editable = False,
show_button = False,
row=0,
)['size'])
Expand All @@ -799,6 +807,7 @@ def updatePosition(value, column):
'Pos',
obj.pos,
['number', 'number'],
label_editable = False,
show_button=False,
row=1,
entry_callback = lambda value, col : updatePosition(value, col),
Expand All @@ -813,6 +822,7 @@ def updatePosition(value, column):
'Angle',
angle,
'number',
label_editable = False,
show_button = False,
row=2,
from_=-360,
Expand Down Expand Up @@ -842,6 +852,7 @@ def updatePosition(value, column):
obj.properties[property],
row = row,
button_text = button_text,
label_editable = property not in obj.defaultProperties,
entry_callback = lambda value, prop = property: updateProperty(prop, value),
label_callback = lambda name, prop = property: updatePropertyName(prop, name),
button_callback = button_callback,
Expand Down Expand Up @@ -1134,7 +1145,6 @@ def saveLevel(self, *args, filename = None):
self.game.gamepath,
self.game.assets,
self.game.baseassets,
'/Levels/',
self.level.filename,
)

Expand Down

0 comments on commit e71b16b

Please sign in to comment.