Skip to content

Commit

Permalink
Remove menu icons from Image Viewer tool (references #368)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisodriscoll committed Aug 12, 2016
1 parent 98d89df commit 25b9707
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
31 changes: 16 additions & 15 deletions src/sas/sasgui/guiframe/local_perspectives/plotting/SimplePlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class PlotFrame(wx.Frame):
Frame for simple plot
"""
def __init__(self, parent, id, title, scale='log_{10}',
size=wx.Size(550, 470)):
size=wx.Size(550, 470), show_menu_icons=True):
"""
comment
:param parent: parent panel/container
Expand All @@ -201,6 +201,7 @@ def __init__(self, parent, id, title, scale='log_{10}',
self.menu_bar = None
self._default_save_location = None
self.scale = scale
self._show_menu_icons = show_menu_icons
self.plotpanel = SimplePlotPanel(self, -1)
self._build_menubar()

Expand All @@ -212,39 +213,40 @@ def _build_menubar(self):
save_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_TOOLBAR, tsize)
quit_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR, tsize)
print_bmp = wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR, tsize)
preview_bmp = wx.ArtProvider.GetBitmap(wx.ART_REPORT_VIEW, wx.ART_TOOLBAR, tsize)
copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize)
menu_bar = wx.MenuBar()

menu = wx.Menu()
id = wx.NewId()
item = wx.MenuItem(menu, id, "&Save Image")
item.SetBitmap(save_bmp)
menu.AppendItem(item)
save_item = wx.MenuItem(menu, id, "&Save Image")
menu.AppendItem(save_item)
wx.EVT_MENU(self, id, self.on_save_file)

id = wx.NewId()
item = wx.MenuItem(menu, id, "&Print Image")
item.SetBitmap(print_bmp)
menu.AppendItem(item)
print_item = wx.MenuItem(menu, id, "&Print Image")
menu.AppendItem(print_item)
wx.EVT_MENU(self, id, self.on_print_image)

menu.AppendSeparator()
id = wx.NewId()
item = wx.MenuItem(menu, id, "&Quit")
item.SetBitmap(quit_bmp)
menu.AppendItem(item)
quit_item = wx.MenuItem(menu, id, "&Quit")
menu.AppendItem(quit_item)

menu_bar.Append(menu, "&File")
wx.EVT_MENU(self, id, self.on_close)

menu_edit = wx.Menu()
id = wx.NewId()
item = wx.MenuItem(menu_edit, id, "&Copy")
item.SetBitmap(copy_bmp)
menu_edit.AppendItem(item)
copy_item = wx.MenuItem(menu_edit, id, "&Copy")
menu_edit.AppendItem(copy_item)
wx.EVT_MENU(self, id, self.on_copy_image)

if self._show_menu_icons:
save_item.SetBitmap(save_bmp)
print_item.SetBitmap(print_bmp)
quit_item.SetBitmap(quit_bmp)
copy_item.SetBitmap(copy_bmp)

menu_bar.Append(menu_edit, "&Edit")
self.menu_bar = menu_bar
self.SetMenuBar(self.menu_bar)
Expand Down Expand Up @@ -323,4 +325,3 @@ def on_close(self, event):
self.parent.on_panel_close(event)
except:
self.Destroy()

5 changes: 2 additions & 3 deletions src/sas/sasgui/perspectives/calculator/image_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def load(self):
if parent != None:
parent.put_icon(plot_frame)
except:
print "parent", parent
err_msg += "Failed to load '%s'.\n" % basename
if err_msg:
if parent is not None:
Expand Down Expand Up @@ -108,7 +107,8 @@ def __init__(self, parent, id, title, image=None, scale='log_{10}',
:param parent: parent panel/container
"""
# Initialize the Frame object
PlotFrame.__init__(self, parent, id, title, scale, size)
PlotFrame.__init__(self, parent, id, title, scale, size,
show_menu_icons=False)
self.parent = parent
self.data = image
self.file_name = title
Expand Down Expand Up @@ -436,4 +436,3 @@ def OnClose(self, event):
app = wx.App()
ImageView(None).load()
app.MainLoop()

0 comments on commit 25b9707

Please sign in to comment.