Exemplo n.º 1
0
    def __init__(self, parent, root):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.parent = parent
        self.root = root

        # Button overlay and binding
        self.btn_add_image = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('plus.png')),
            size=(CompositeGallery.btn_size, ) * 2)

        # Image gallery subwidget
        self.pnl_gallery = WidgetGallery(self, self.root)

        # Button overlay binding - Must be after subwidget to bind to
        self.btn_add_image.Bind(wx.EVT_BUTTON, self.pnl_gallery.evt_add_image)
        self.btn_add_image.Bind(wx.EVT_SET_FOCUS, self.evt_btn_no_focus)

        # Main sizer - do not add button so it floats
        szr_main = wx.BoxSizer(wx.VERTICAL)
        szr_main.Add(self.pnl_gallery, proportion=1, flag=wx.EXPAND)
        self.SetSizer(szr_main)

        # Bind button movement to resize
        self.Bind(wx.EVT_SIZE, self.evt_resize)
Exemplo n.º 2
0
    def __init__(self, parent, root):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.parent = parent
        self.root = root

        # List of text objects in the header
        self.header_list = []

        # Draw button first, as the first object drawn stays on top
        self.btn_add_note = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('plus.png')),
            size=(CompositeNotes.btn_size, ) * 2)

        # Set up sizer to contain header and scrolled notes
        self.pnl_notes = NotesScrolled(self, self.root)

        # Button overlay binding - Must be after subwidget to bind to
        self.btn_add_note.Bind(wx.EVT_BUTTON, self.pnl_notes.evt_add_note)
        self.btn_add_note.Bind(wx.EVT_SET_FOCUS, self.evt_button_no_focus)

        # Binding for clicking between notes text
        self.pnl_notes.Bind(wx.EVT_LEFT_UP, self.evt_edit_note)

        # Main Sizer
        self.szr_title = wx.BoxSizer(wx.HORIZONTAL)
        self.szr_main = wx.BoxSizer(wx.VERTICAL)
        self.szr_main.Add(self.szr_title, flag=wx.ALL | wx.EXPAND)
        self.szr_main.Add(self.pnl_notes,
                          proportion=1,
                          flag=wx.ALL | wx.EXPAND)

        self.header_list.append(
            wx.StaticText(self, label="Date", style=wx.ALIGN_LEFT))
        self.header_list.append(
            wx.StaticText(self, label="Author", style=wx.ALIGN_LEFT))
        self.header_list.append(
            wx.StaticText(self, label="Note", style=wx.ALIGN_LEFT))

        self.szr_title.Add(self.header_list[0])
        self.szr_title.Add(self.header_list[1])
        self.szr_title.Add(self.header_list[2], proportion=1)
        #self.szr_title.Add(self.header_list[3])

        # Refresh headers, repopulating self.sizer_title
        self.refresh_headers()

        # Set sizer and resize
        self.SetSizer(self.szr_main)
        self.Layout()

        # Bind button movement to resize
        self.Bind(wx.EVT_SIZE, self.evt_resize)
Exemplo n.º 3
0
    def __init__(self, parent, root):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.parent = parent
        self.root = root

        # Primary part image
        if self.parent.mugshot:
            image = wx.Image(
                fn_path.concat_img(self.parent.part_num, self.parent.mugshot),
                wx.BITMAP_TYPE_ANY)
        else:
            image = wx.Image(fn_path.concat_gui('missing_mugshot.png'),
                             wx.BITMAP_TYPE_ANY)

        # Draw button first as first drawn stays on top
        self.button_dwg = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('schematic.png')),
            size=(CompositeMugshot.btn_size, ) * 2,
            pos=(0, CompositeMugshot.mug_size - CompositeMugshot.btn_size))
        self.button_dwg.Bind(wx.EVT_SET_FOCUS, self.event_button_no_focus)
        self.button_dwg.Bind(wx.EVT_BUTTON, self.evt_blueprint)

        self.imageBitmap = wx.StaticBitmap(self,
                                           bitmap=wx.Bitmap(
                                               fn_gfx.crop_square(
                                                   image,
                                                   CompositeMugshot.mug_size)))

        self.sizer_main = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer_main.Add(self.imageBitmap, flag=wx.ALL)

        self.SetSizer(self.sizer_main)
        self.Layout()
        self.Fit()
Exemplo n.º 4
0
    def refresh(self, new_image=None):
        """Updates the mugshot to the image hash provided, directs to the no-image if None is provided

            Args:
                new_image (str): Image filename for mugshot to display
        """
        if new_image:
            temp = fn_path.concat_img(self.parent.part_num, new_image)
        else:
            temp = fn_path.concat_gui('missing_mugshot.png')

        # Update image
        self.imageBitmap.SetBitmap(
            wx.Bitmap(
                fn_gfx.crop_square(wx.Image(temp), CompositeMugshot.mug_size)))
Exemplo n.º 5
0
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        self.SetDoubleBuffered(
            True)  # Remove odd effects at main switch to this pane after login

        self.parent = parent

        # Search bar and bind
        self.wgt_searchbar = wx.TextCtrl(self,
                                         size=(PaneMain.bar_size * 10,
                                               PaneMain.bar_size),
                                         style=wx.TE_PROCESS_ENTER)
        self.wgt_searchbar.Bind(wx.EVT_TEXT_ENTER, self.evt_search)

        # Search bar button and bind
        btn_search = wx.BitmapButton(self,
                                     bitmap=wx.Bitmap(
                                         fn_path.concat_gui('search.png')),
                                     size=(PaneMain.bar_size, ) * 2)
        btn_search.Bind(wx.EVT_BUTTON, self.evt_search)
        btn_search.Bind(wx.EVT_SET_FOCUS, self.evt_button_no_focus)

        # Notebook widget
        self.wgt_notebook = tab.Notebook(self)

        # Top bar sizer
        szr_bar = wx.BoxSizer(wx.HORIZONTAL)
        szr_bar.AddSpacer(3)
        szr_bar.Add(self.wgt_searchbar)
        szr_bar.AddSpacer(2)
        szr_bar.Add(btn_search)

        # Main Sizer
        self.szr_main = wx.BoxSizer(wx.VERTICAL)
        self.szr_main.Add(szr_bar, flag=wx.EXPAND)
        self.szr_main.AddSpacer(1)
        self.szr_main.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL),
                          flag=wx.EXPAND)
        self.szr_main.Add(self.wgt_notebook, proportion=1, flag=wx.EXPAND)

        self.SetSizer(self.szr_main)
Exemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        """Constructor"""
        wx.Frame.__init__(self, *args, **kwargs)

        # Define the two primary sizers for different panes
        self.szr_login = wx.BoxSizer(wx.VERTICAL)
        self.szr_main = wx.BoxSizer(wx.VERTICAL)

        # Define the main pane, hide until after login, add to sizer
        self.pane_main = pane.PaneMain(self)
        self.pane_main.Hide()
        self.szr_main.Add(self.pane_main, proportion=1, flag=wx.EXPAND)

        # Define the login pane, add to sizer
        self.pane_login = pane.PaneLogin(self, self.szr_main, self.pane_main)
        self.szr_login.Add(self.pane_login, proportion=1, flag=wx.EXPAND)

        # Define lower status bar
        self.status = self.CreateStatusBar(1)
        self.status.SetStatusText("Written by Ancient Abysswalker")

        # Disable menu bar for the moment as I don't have a need for it
        # self.menubar = wx.MenuBar()
        # menu_file = wx.Menu()
        # menu_edit = wx.Menu()
        # menu_help = wx.Menu()
        # menu_file.Append(wx.NewId(), "New", "Creates A new file")
        # append_item = menu_file.Append(wx.NewId(), "Add ID", "Add an ID")
        # self.Bind(wx.EVT_MENU, self.evt_on_add, append_item)
        # self.menubar.Append(menu_file, "File")
        # self.menubar.Append(menu_edit, "Edit")
        # self.menubar.Append(menu_help, "Help")
        # self.SetMenuBar(self.menubar)

        # Set icon
        self.SetIcon(wx.Icon(fn_path.concat_gui('icon.png')))

        # Set window minimum size, set starting sizer and show window
        self.SetMinSize((700, 500))
        self.SetSizer(self.szr_login)
        self.Show()
Exemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        """Constructor"""
        wx.Frame.__init__(self, *args, **kwargs)

        # Define the primary sizer for the primary pane
        self.szr_main = wx.BoxSizer(wx.VERTICAL)

        # Define the main pane, hide until after login, add to sizer
        self.pane_main = pane.PaneMain(self)
        self.szr_main.Add(self.pane_main, proportion=1, flag=wx.EXPAND)

        # Define lower status bar
        self.status = self.CreateStatusBar(1)
        self.status.SetStatusText("Written by Ancient Abysswalker")

        # Set icon
        self.SetIcon(wx.Icon(fn_path.concat_gui('icon.png')))

        # Set window minimum size, set starting sizer and show window
        self.SetMinSize((700, 500))
        self.SetSizer(self.szr_main)
        self.Show()
Exemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        """Constructor"""
        wx.Frame.__init__(self, *args, **kwargs)

        # Define the main pane  and add to the primary sizer
        self.pane_main = pane.PaneMain(self)
        self.szr_main = wx.BoxSizer(wx.VERTICAL)
        self.szr_main.Add(self.pane_main, proportion=1, flag=wx.EXPAND)

        # Define lower status bar
        self.status_bar = wx.StatusBar(self, 1)
        self.status_bar.SetFieldsCount(2)
        self.status_bar.SetStatusWidths([-1, 55])
        self.SetStatusBar(self.status_bar)
        self.status_bar.SetStatusText("Written by Ancient Abysswalker", 0)
        self.status_bar.SetStatusText("Build " + BUILD, 1)

        # Set icon
        self.SetIcon(wx.Icon(fn_path.concat_gui('icon.png')))

        # Set window minimum size, set starting sizer and show window
        self.SetMinSize((300, 300))
        self.SetSizer(self.szr_main)
        self.Show()
Exemplo n.º 9
0
    def __init__(self, parent, part_num, part_rev):
        """Constructor"""
        wx.Panel.__init__(
            self, parent,
            size=(0, 0))  # Needs size parameter to remove black-square
        self.SetDoubleBuffered(True)  # Remove slight strobing on tab switch
        self.SetCursor(wx.Cursor(wx.CURSOR_ARROW)
                       )  # Ensure that edit cursor does not show by default

        # Variable initialization
        self.parent = parent
        self.part_num = part_num
        self.part_rev = part_rev
        self.part_type = "You Should NEVER See This Text!!"
        self.short_description = "You Should NEVER See This Text!!"
        self.long_description = "You Should NEVER See This Text!!" \
                                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque tempor, elit " \
                                "sed pulvinar feugiat, tortor tortor posuere neque, eget ultrices eros est laoreet " \
                                "velit. Aliquam erat volutpat. Donec mi libero, elementum eu augue eget, iaculis " \
                                "dignissim ex. Nullam tincidunt nisl felis, eu efficitur turpis sodales et. Fusce " \
                                "vestibulum lacus sit amet ullamcorper efficitur. Morbi ultrices commodo leo, " \
                                "ultricies posuere mi finibus id. Nulla convallis velit ante, sed egestas nulla " \
                                "dignissim ac."
        self.suc_number = "BADBADBAD"
        self.suc_revision = "BAD"
        self.mugshot = None
        self.drawing = None
        self.sub_data_list = []
        self.super_data_list = []

        # Method to load data
        self.load_data()

        # Top row of informational text widgets, and binds
        self.wgt_txt_part_num = wx.StaticText(self,
                                              label=self.part_num,
                                              style=wx.ALIGN_CENTER)
        self.wgt_txt_part_rev = wx.StaticText(self,
                                              label="r" + self.part_rev,
                                              style=wx.ALIGN_CENTER)
        self.wgt_txt_part_type = self.style_null_entry(
            self.part_type,
            wx.StaticText(self, size=(100, -1), style=wx.ALIGN_CENTER))
        self.wgt_txt_description_short = self.style_null_entry(
            self.short_description,
            wx.StaticText(self, style=wx.ST_ELLIPSIZE_END))
        self.revision_bind(self.wgt_txt_description_short, "Short Description",
                           "name")
        self.wgt_txt_part_type.Bind(wx.EVT_LEFT_DCLICK, self.evt_edit_type)

        # Revision number buttons and bindings
        self.wgt_btn_rev_next = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('r_arr_rev.png')),
            size=(10, TabPartInfo.btn_rev_size))
        self.wgt_btn_rev_prev = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('l_arr_rev.png')),
            size=(10, TabPartInfo.btn_rev_size))
        self.wgt_btn_rev_next.Bind(wx.EVT_BUTTON, self.event_rev_next)
        self.wgt_btn_rev_prev.Bind(wx.EVT_BUTTON, self.event_rev_prev)
        self.wgt_btn_rev_next.Bind(wx.EVT_SET_FOCUS, self.evt_btn_no_focus)
        self.wgt_btn_rev_prev.Bind(wx.EVT_SET_FOCUS, self.evt_btn_no_focus)

        # Sizer for top row of information, including revision buttons
        self.szr_infoline = wx.BoxSizer(wx.HORIZONTAL)
        self.szr_infoline.Add(self.wgt_txt_part_num, border=5, flag=wx.ALL)
        self.szr_infoline.Add(self.wgt_btn_rev_prev, flag=wx.ALL)
        self.szr_infoline.Add(self.wgt_txt_part_rev, border=5, flag=wx.ALL)
        self.szr_infoline.Add(self.wgt_btn_rev_next, flag=wx.ALL)
        self.szr_infoline.AddSpacer(5)
        self.szr_infoline.Add(wx.StaticLine(self, style=wx.LI_VERTICAL),
                              flag=wx.EXPAND)
        self.szr_infoline.Add(self.wgt_txt_part_type, border=5, flag=wx.ALL)
        self.szr_infoline.Add(wx.StaticLine(self, style=wx.LI_VERTICAL),
                              flag=wx.EXPAND)
        self.szr_infoline.Add(self.wgt_txt_description_short,
                              proportion=1,
                              border=5,
                              flag=wx.ALL | wx.EXPAND)

        # Long description widget, sizer, and bind
        self.wgt_txt_description_long = self.style_null_entry(
            self.long_description,
            wx.TextCtrl(self,
                        size=(-1, 35),
                        style=wx.TE_MULTILINE | wx.TE_WORDWRAP | wx.TE_READONLY
                        | wx.BORDER_NONE))
        self.szr_long_descrip = wx.StaticBoxSizer(wx.StaticBox(
            self, label="Extended Description"),
                                                  orient=wx.VERTICAL)
        self.szr_long_descrip.Add(self.wgt_txt_description_long,
                                  flag=wx.ALL | wx.EXPAND)
        self.wgt_txt_description_long.Bind(wx.EVT_SET_FOCUS, self.evt_onfocus)
        self.revision_bind(self.wgt_txt_description_long, "Long Description",
                           "description")

        # Notes widget and sizer
        self.wgt_notes = widget.CompositeNotes(self, self)
        self.szr_notes = wx.StaticBoxSizer(wx.StaticBox(self, label='Notes'),
                                           orient=wx.VERTICAL)
        self.szr_notes.Add(self.wgt_notes,
                           proportion=1,
                           flag=wx.ALL | wx.EXPAND)

        # Gallery widget and sizer
        self.wgt_gallery = widget.CompositeGallery(self, self)
        self.szr_gallery = wx.StaticBoxSizer(wx.StaticBox(
            self, label='Image Gallery'),
                                             orient=wx.VERTICAL)
        self.szr_gallery.Add(self.wgt_gallery,
                             proportion=1,
                             flag=wx.ALL | wx.EXPAND)

        # Mugshot widget
        self.wgt_mugshot = widget.CompositeMugshot(self, self)

        # Assemblies info widget
        self.wgt_assm = widget.CompositeAssemblies(self, self)

        # Left Master Sizer
        self.szr_master_left = wx.BoxSizer(wx.VERTICAL)
        self.szr_master_left.Add(self.szr_infoline, flag=wx.ALL | wx.EXPAND)
        self.szr_master_left.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL),
                                 flag=wx.EXPAND)
        self.szr_master_left.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL),
                                 flag=wx.EXPAND)
        self.szr_master_left.AddSpacer(5)
        self.szr_master_left.Add(self.szr_long_descrip,
                                 flag=wx.ALL | wx.EXPAND)  # , border=15)
        self.szr_master_left.Add(self.szr_notes,
                                 proportion=1,
                                 flag=wx.ALL | wx.EXPAND)  # , border=15)
        self.szr_master_left.Add(self.szr_gallery,
                                 proportion=2,
                                 flag=wx.ALL | wx.EXPAND)

        # Right Master Sizer
        self.szr_master_right = wx.BoxSizer(wx.VERTICAL)
        self.szr_master_right.Add(self.wgt_mugshot, flag=wx.ALL)
        self.szr_master_right.Add(self.wgt_assm,
                                  proportion=1,
                                  flag=wx.ALL | wx.EXPAND)

        # Master Sizer
        self.szr_master = wx.BoxSizer(wx.HORIZONTAL)
        self.szr_master.Add(self.szr_master_left,
                            proportion=1,
                            flag=wx.ALL | wx.EXPAND)
        self.szr_master.Add(wx.StaticLine(self, style=wx.LI_VERTICAL),
                            flag=wx.EXPAND)
        self.szr_master.Add(self.szr_master_right, flag=wx.ALL | wx.EXPAND)

        # Set Sizer
        self.SetSizer(self.szr_master)
Exemplo n.º 10
0
    def __init__(self, parent, root_pane):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        # Parental inheritance
        self.parent = parent
        self.root_tab = parent
        self.root_pane = root_pane

        # File drop hook
        file_drop_target = DummyFileDrop(self, self.evt_dragged_files)

        # Button overlay and binding
        self.btn_add_image = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('plus.png')),
            size=(CompositeLibrary.btn_size, ) * 2)

        # Library subwidget
        self.pnl_library = ULC.UltimateListCtrl(self,
                                                wx.ID_ANY,
                                                agwStyle=wx.LC_REPORT
                                                | wx.LC_VRULES | wx.LC_HRULES)
        self.pnl_library.Bind(ULC.EVT_LIST_ITEM_ACTIVATED,
                              self.evt_open_document)

        info = ULC.UltimateListItem()
        info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_CHECK
        info._image = []
        info._format = 0
        info._kind = 1
        info._text = "File Name"
        self.pnl_library.InsertColumnInfo(0, info)

        info = ULC.UltimateListItem()
        info._format = wx.LIST_FORMAT_RIGHT
        info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_FONT
        info._image = []
        info._text = "Title"
        # info._font = boldfont
        self.pnl_library.InsertColumnInfo(1, info)

        info = ULC.UltimateListItem()
        info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        info._format = 0
        info._text = "Category"
        # info._font = font
        info._image = []
        self.pnl_library.InsertColumnInfo(2, info)

        info = ULC.UltimateListItem()
        info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        info._format = 0
        info._text = "Discipline"
        # info._font = font
        info._image = []
        self.pnl_library.InsertColumnInfo(3, info)

        for i, result in enumerate(self.parent.search_results):
            self.pnl_library.InsertStringItem(i, result[0])
            self.pnl_library.SetStringItem(i, 1, result[1])
            self.pnl_library.SetStringItem(
                i, 2, self.root_pane.id_to_category[result[2]])
            self.pnl_library.SetStringItem(
                i, 3, self.root_pane.id_to_discipline[result[3]])

        self.pnl_library.SetColumnWidth(0, 120)
        self.pnl_library.SetColumnWidth(1, 120)
        self.pnl_library.SetColumnWidth(2, 120)
        self.pnl_library.SetColumnWidth(3, -3)

        # Button overlay binding - Must be after subwidget to bind to
        self.btn_add_image.Bind(wx.EVT_BUTTON, self.evt_click_button)
        self.btn_add_image.Bind(wx.EVT_SET_FOCUS, self.evt_btn_no_focus)
        self.btn_add_image.SetDropTarget(file_drop_target)

        # Main sizer - do not add button so it floats
        szr_main = wx.BoxSizer(wx.VERTICAL)
        szr_main.Add(self.pnl_library, proportion=1, flag=wx.EXPAND)
        self.SetSizer(szr_main)

        # Bind button movement to resize
        self.Bind(wx.EVT_SIZE, self.evt_resize)
Exemplo n.º 11
0
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        self.SetDoubleBuffered(
            True)  # Remove odd effects at main switch to this pane after login

        # Parental inheritance
        self.parent = parent

        # Set user for application
        self.user = os.getlogin()

        # Load tags and the mapping of tag to id
        self.ls_tags = []
        self.tag_to_id = {}
        self.load_tags()

        # Define and load mappings between id and discipline
        self.id_to_discipline = {}
        self.discipline_to_id = {}
        self.load_disciplines()

        # Define and load mappings between id and category
        self.id_to_category = {}
        self.category_to_id = {}
        self.load_categories()

        # Define and load mappings between id and level3
        self.id_to_level3 = {}
        self.level3_to_id = {}
        self.load_level3()

        # Search bar and bind
        self.wgt_searchbar = wx.TextCtrl(self,
                                         size=(PaneMain.bar_size * 10,
                                               PaneMain.bar_size),
                                         style=wx.TE_PROCESS_ENTER)
        self.wgt_searchbar.Bind(wx.EVT_TEXT_ENTER, self.evt_search)

        # Search bar button and bind
        btn_search = wx.BitmapButton(self,
                                     bitmap=wx.Bitmap(
                                         fn_path.concat_gui('search.png')),
                                     size=(PaneMain.bar_size, ) * 2)
        btn_search.Bind(wx.EVT_BUTTON, self.evt_search)
        btn_search.Bind(wx.EVT_SET_FOCUS, self.evt_button_no_focus)

        # Notebook widget
        self.wgt_notebook = tab.Notebook(self)

        # Restrictions sizer
        self.wgt_restrictions = widget.Restrictions(self)
        self.wgt_restrictions.Bind(wx.EVT_LEFT_DOWN,
                                   self.wgt_restrictions.evt_click_header)
        self.wgt_restrictions.SetMinSize((500, -1))

        # Top bar sizer
        szr_top_bar = wx.BoxSizer(wx.HORIZONTAL)
        szr_top_bar.AddSpacer(3)
        szr_top_bar.Add(self.wgt_searchbar)
        szr_top_bar.AddSpacer(2)
        szr_top_bar.Add(btn_search)
        szr_top_bar.Add(wx.StaticText(self), proportion=1)
        szr_top_bar.Add(self.wgt_restrictions, flag=wx.RIGHT)
        szr_top_bar.AddSpacer(2)

        # Main Sizer
        self.szr_main = wx.BoxSizer(wx.VERTICAL)
        self.szr_main.Add(szr_top_bar, flag=wx.EXPAND)
        self.szr_main.AddSpacer(1)
        self.szr_main.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL),
                          flag=wx.EXPAND)
        self.szr_main.Add(self.wgt_notebook, proportion=1, flag=wx.EXPAND)

        # Set sizer and refresh layout
        self.SetSizer(self.szr_main)
        self.Layout()
Exemplo n.º 12
0
    def __init__(self, parent, root):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.parent = parent
        self.root = root

        # Draw Sub-Assembly edit button
        self.btn_sub_edit = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('edit.png')),
            size=(CompositeAssemblies.btn_size, ) * 2)
        self.btn_sub_edit.Bind(wx.EVT_SET_FOCUS, self.evt_button_no_focus)
        self.btn_sub_edit.Bind(wx.EVT_BUTTON, self.evt_sub_edit)

        # Draw Sub-Assembly help button
        self.btn_sub_help = wx.StaticBitmap(
            self, bitmap=wx.Bitmap(fn_path.concat_gui('help.png')))
        self.btn_sub_help.Bind(wx.EVT_LEFT_UP, self.evt_sub_help)

        # Draw Super-Assembly edit button
        self.btn_super_edit = wx.BitmapButton(
            self,
            bitmap=wx.Bitmap(fn_path.concat_gui('edit.png')),
            size=(CompositeAssemblies.btn_size, ) * 2)
        self.btn_super_edit.Bind(wx.EVT_SET_FOCUS, self.evt_button_no_focus)
        self.btn_super_edit.Bind(wx.EVT_BUTTON, self.evt_super_edit)

        # Draw Super-Assembly help button
        self.btn_super_help = wx.StaticBitmap(
            self, bitmap=wx.Bitmap(fn_path.concat_gui('help.png')))
        self.btn_super_help.Bind(wx.EVT_LEFT_UP, self.evt_super_help)

        # Lists containing sub and super assembly info
        self.wgt_sub_assm = wx.ListBox(
            self,
            choices=[i[0] + " r" + i[1] for i in self.root.helper_wgt_sub],
            size=(CompositeMugshot.mug_size // 2, -1),
            style=wx.LB_SINGLE | wx.LB_ALWAYS_SB)
        self.wgt_super_assm = wx.ListBox(
            self,
            choices=[i[0] + " r" + i[1] for i in self.root.helper_wgt_super],
            size=(CompositeMugshot.mug_size // 2, -1),
            style=wx.LB_SINGLE | wx.LB_ALWAYS_SB)

        # Assembly list binds
        self.wgt_sub_assm.Bind(wx.EVT_LISTBOX, self.evt_click_sub_assm)
        self.wgt_sub_assm.Bind(wx.EVT_MOTION, self.evt_update_tooltip_sub)
        self.wgt_super_assm.Bind(wx.EVT_LISTBOX, self.evt_click_super_assm)
        self.wgt_super_assm.Bind(wx.EVT_MOTION, self.evt_update_tooltip_super)

        # Assembly and Main Sizers
        self.szr_sub_assm = wx.BoxSizer(wx.VERTICAL)
        self.szr_sub_assm.Add(wx.StaticText(self,
                                            label="Sub-Assemblies",
                                            style=wx.ALIGN_CENTER),
                              border=5,
                              flag=wx.ALL | wx.EXPAND)
        self.szr_sub_assm.Add(self.wgt_sub_assm,
                              proportion=1,
                              flag=wx.ALL | wx.EXPAND)
        self.szr_super_assm = wx.BoxSizer(wx.VERTICAL)
        self.szr_super_assm.Add(wx.StaticText(self,
                                              label="Super-Assemblies",
                                              style=wx.ALIGN_CENTER),
                                border=5,
                                flag=wx.ALL | wx.EXPAND)
        self.szr_super_assm.Add(self.wgt_super_assm,
                                proportion=1,
                                flag=wx.ALL | wx.EXPAND)
        self.szr_main = wx.BoxSizer(wx.HORIZONTAL)
        self.szr_main.Add(self.szr_sub_assm,
                          proportion=1,
                          flag=wx.ALL | wx.EXPAND)
        self.szr_main.Add(self.szr_super_assm,
                          proportion=1,
                          flag=wx.ALL | wx.EXPAND)

        # Set main sizer and recalculate the layout
        self.SetSizer(self.szr_main)
        self.Layout()

        # Bind button movement to resize
        self.Bind(wx.EVT_SIZE, self.evt_resize)