def get_bitmap(self, bitmap_name): """Returns a wx.Bitmap instance of the given bitmap's name if found in the app's resources folder.""" full_bitmap_path = os.path.join(pathfinder.bitmap_path(), bitmap_name) if os.path.exists(full_bitmap_path): return wx.Bitmap(name=full_bitmap_path, type=wx.BITMAP_TYPE_PNG) return None
def on_about_icons(self, evt): """Handles the About Icons event""" axialis_logo = os.path.join(pathfinder.bitmap_path(), "axialis_logo.png") axialis_msg = ' '.join(("Some icons courtesy Axialis Software and the", "Axialis Team, and were created by", "Axialis IconWorkshop.")) about_axialisicons_dlg = dlg.AboutDialog(parent=self.view, title="About Axialis Icons", msg=axialis_msg, url="http://www.axialis.com", logobmp_fname=axialis_logo) about_axialisicons_dlg.ShowModal() about_axialisicons_dlg.Destroy()
def init_ui(self): """Initializes and lays out the UI""" self.sizer = wx.BoxSizer(wx.VERTICAL) self.main_panel = wx.Panel(self) self.main_panel_sizer = wx.BoxSizer(wx.HORIZONTAL) glyph_fn = os.path.join(pathfinder.bitmap_path(), "axis_glyph_sm.png") glyph = wx.Bitmap(glyph_fn, type=wx.BITMAP_TYPE_PNG) glyph_ctrl = statbmp.GenStaticBitmap(self.main_panel, wx.ID_ANY, glyph, style=wx.ALIGN_CENTRE_VERTICAL, size=(glyph.GetWidth(), glyph.GetHeight())) self.main_panel_sizer.Add(glyph_ctrl, ui_defaults.lbl_pct, ui_defaults.lblsizer_flags, ui_defaults.widget_margin) ctrl_panel = wx.Panel(self.main_panel) ctrl_panel_sizer = wx.BoxSizer(wx.VERTICAL) instructions_txt = '\n'.join(['To continue, please specify a plane in the 3-D data.', 'A plane is defined by an orientation and an index', 'into the data. Orientation determines which direction', 'the slice is made, and the index specifies where in', 'the remaining axis the slice is made.']) instructions_lbl = wx.StaticText(ctrl_panel, wx.ID_ANY, instructions_txt) ctrl_panel_sizer.Add(instructions_lbl, ui_defaults.lbl_pct, ui_defaults.lblsizer_flags, ui_defaults.widget_margin) orientation_panel = wx.Panel(ctrl_panel) orientation_panel_sizer = wx.BoxSizer(wx.HORIZONTAL) orientation_lbl = wx.StaticText(orientation_panel, wx.ID_ANY, "Orientation") orientation_panel_sizer.Add(orientation_lbl, ui_defaults.lbl_pct, ui_defaults.lblsizer_flags, ui_defaults.widget_margin) self.plane_choice = wx.Choice(orientation_panel, wx.ID_ANY, choices=self.planes) orientation_panel_sizer.Add(self.plane_choice, ui_defaults.ctrl_pct, ui_defaults.sizer_flags, ui_defaults.widget_margin) orientation_panel.SetSizerAndFit(orientation_panel_sizer) ctrl_panel_sizer.Add(orientation_panel, ui_defaults.ctrl_pct, ui_defaults.sizer_flags, 0) idx_panel = wx.Panel(ctrl_panel) idx_panel_sizer = wx.BoxSizer(wx.HORIZONTAL) idx_lbl = wx.StaticText(idx_panel, wx.ID_ANY, "Index") idx_panel_sizer.Add(idx_lbl, ui_defaults.ctrl_pct, ui_defaults.lblsizer_flags, ui_defaults.widget_margin) self.idx_sc = wx.SpinCtrl(idx_panel, wx.ID_ANY) idx_panel_sizer.Add(self.idx_sc, ui_defaults.ctrl_pct, ui_defaults.sizer_flags, ui_defaults.widget_margin) idx_panel.SetSizerAndFit(idx_panel_sizer) self.Bind(wx.EVT_CHOICE, self.on_orientation_change, self.plane_choice) self.plane_choice.SetSelection(0) self.set_index_limits() ctrl_panel_sizer.Add(idx_panel, ui_defaults.ctrl_pct, ui_defaults.sizer_flags, 0) ctrl_panel.SetSizerAndFit(ctrl_panel_sizer) self.main_panel_sizer.Add(ctrl_panel, ui_defaults.lbl_pct, ui_defaults.lblsizer_flags, 0) self.main_panel.SetSizer(self.main_panel_sizer) self.sizer.Add(self.main_panel, 1, ui_defaults.sizer_flags, 0) self._generate_std_buttons() self.SetSizerAndFit(self.sizer)
def on_about_tri(self, evt): """Handles the About TRI event""" tri_logo = os.path.join(pathfinder.bitmap_path(), "tri_austin_logo.png") tri_msg = ' '.join( ("Texas Research Institute Austin, Inc. (TRI/Austin) is TRI's flagship company", "and conducts materials research and development projects.\n\nTRI is committed to", "providing the highest quality materials science products and services.")) about_tri_dlg = dlg.AboutDialog(parent=self.view, title="About TRI", msg=tri_msg, url="http://www.tri-austin.com", logobmp_fname=tri_logo) about_tri_dlg.ShowModal() about_tri_dlg.Destroy()
def test_bitmaps_path(self): """Verify correct bitmap path""" bmap_path = os.path.join(self.app_path, 'resources', 'bitmaps') self.assertEqual(bmap_path, pathfinder.bitmap_path())
def get_bitmap(self, bitmap_name): """Given the base name for a file, returns a wx Bitmap instance from the bitmap folder""" return wx.Bitmap(os.path.join(pathfinder.bitmap_path(), bitmap_name))
def plot_blank(self): """Returns a wx Bitmap placeholder to display when thumbnails are disabled""" return wx.Bitmap( os.path.join(pathfinder.bitmap_path(), 'thumbs_disabled.png'))
def plot_blank(self): """Returns a wx Bitmap placeholder to display when thumbnails are disabled""" return wx.Bitmap(os.path.join(pathfinder.bitmap_path(), 'thumbs_disabled.png'))