Skip to content

Commit

Permalink
Dynamically rebuild menu when options change - should fix #865
Browse files Browse the repository at this point in the history
  • Loading branch information
kliment committed Mar 23, 2018
1 parent 81b8ad8 commit a280f44
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ def __init__(self, app, filename = None, size = winsize):

except:
pass
self.create_menu()
self.update_recent_files("recentfiles", self.settings.recentfiles)

self.menustrip = wx.MenuBar()
self.reload_ui()
# disable all printer controls until we connect to a printer
self.gui_set_disconnected()
Expand Down Expand Up @@ -264,6 +262,8 @@ def reload_ui(self, *args):
if self.ui_ready:
# Store log console content
logcontent = self.logbox.GetValue()
while self.menustrip.GetMenuCount():
self.menustrip.Remove(0)
if(len(self.commandbox.history)):
#save current command box history
history = (self.history_file)
Expand All @@ -284,6 +284,8 @@ def reload_ui(self, *args):
self.reset_ui()

# Create UI
self.create_menu()
self.update_recent_files("recentfiles", self.settings.recentfiles)
if 0: #self.settings.uimode in (_("Tabbed"), _("Tabbed with platers")): #disable tabbed mode for now
self.createTabbedGui()
else:
Expand Down Expand Up @@ -734,7 +736,6 @@ def sendline(self, e):

def create_menu(self):
"""Create main menu"""
self.menustrip = wx.MenuBar()

# File menu
m = wx.Menu()
Expand Down

0 comments on commit a280f44

Please sign in to comment.