Exemple #1
0
    def __init__(self, parent, id, log, galaxy):
        wx.Panel.__init__(self, parent)
        self.selectedID = ''
        self.galaxy = galaxy
        self.SetAutoLayout(True)
        self.SetBackgroundColour("ORANGE")

        self.mainGrid = gridControl.GridControlParent(self, log,
                                                      anwp.war.ship.Ship({}),
                                                      1)
        self.mainGrid.loadData(galaxy.ships, 1)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 20)
        self.mainGrid.SetConstraints(lc)

        self.subNotebook = QuadNotebook(self, id, log, galaxy)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.mainGrid, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 65)
        self.subNotebook.SetConstraints(lc)

        self.subQuadNotebook = SubQuadNotebook(self, id, log, galaxy)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.subNotebook, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        self.subQuadNotebook.SetConstraints(lc)
Exemple #2
0
    def __init__(self, parent, id, log, galaxy):
        wx.Panel.__init__(self, parent)
        self.selectedID = '1'
        self.galaxy = galaxy
        self.SetAutoLayout(True)
        self.SetBackgroundColour("MEDIUM ORCHID")

        self.mainGrid = gridControl.GridControlParent(
            self, log, anwp.aw.system.System({}), 1)
        self.mainGrid.loadData(galaxy.systems, 0)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 50)
        self.mainGrid.SetConstraints(lc)

        self.subNotebook = SubNotebook(self, id, log, galaxy, self.selectedID)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.mainGrid, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        self.subNotebook.SetConstraints(lc)
Exemple #3
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           'About SuperDoodle',
                           size=(420, 380))

        html = wx.html.HtmlWindow(self, -1)
        html.SetPage(self.text)
        button = wx.Button(self, wx.ID_OK, "Okay")

        # constraints for the html window
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.bottom.SameAs(button, wx.Top, 5)
        lc.right.SameAs(self, wx.Right, 5)
        html.SetConstraints(lc)

        # constraints for the button
        lc = wx.LayoutConstraints()
        lc.bottom.SameAs(self, wx.Bottom, 5)
        lc.centreX.SameAs(self, wx.CentreX)
        lc.width.AsIs()
        lc.height.AsIs()
        button.SetConstraints(lc)

        self.SetAutoLayout(True)
        self.Layout()
        self.CentreOnParent(wx.BOTH)
Exemple #4
0
    def __init__(self, parent, id, log, galaxy):
        wx.Panel.__init__(self, parent)
        self.galaxy = galaxy
        self.SetAutoLayout(True)
        self.SetBackgroundColour("SIENNA")

        self.mainGrid = gridControl.GridControl(self, log,
                                                anwp.aw.galaxy.Galaxy({}), 1)
        cellData = []
        cellData.append(galaxy.getAttributes(True))
        self.mainGrid.PopulateGrid(self.mainGrid.header, cellData)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 10)
        self.mainGrid.SetConstraints(lc)

        self.subNotebook = SubNotebook(self, id, log, galaxy)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.mainGrid, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        self.subNotebook.SetConstraints(lc)
Exemple #5
0
    def __init__(self, parent, ID, title):
        wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition,
                          wx.Size(500, 400))
        self.SetAutoLayout(True)
        self.CreateStatusBar()
        self.SetStatusText("This is the statusbar")
        menu = wx.Menu()
        menu.Append(ID_ABOUT, "&About", "More information about this program")
        menu.AppendSeparator()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")

        menuBar = wx.MenuBar()
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)

        params_panel = ParamsPanel(self, -1)
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 5)
        lc.bottom.SameAs(self, wx.Bottom, 5)
        lc.width.PercentOf(self, wx.Width, 40)
        params_panel.SetConstraints(lc)

        seq_panel = SeqPanel(self, -1)
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.RightOf(params_panel, 5)
        lc.bottom.SameAs(self, wx.Bottom, 5)
        lc.right.SameAs(self, wx.Right)
        seq_panel.SetConstraints(lc)

        self.seq_panel = seq_panel
        self.params_panel = params_panel

        wx.EVT_MENU(self, ID_EXIT, self.exit)
Exemple #6
0
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)
        codon_table_static = wx.StaticText(self,
                                           -1,
                                           'Codon Tables',
                                           style=wx.ALIGN_CENTER)
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.AsIs()
        lc.right.SameAs(self, wx.Right, 5)
        codon_table_static.SetConstraints(lc)

        codon_table_lb = wx.ListBox(self, ID_CODON)
        lc = wx.LayoutConstraints()
        lc.top.Below(codon_table_static, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.PercentOf(self, wx.Height, 30)
        lc.right.SameAs(self, wx.Right, 5)
        codon_table_lb.SetConstraints(lc)
        self.codon_table_lb = codon_table_lb

        codon_table_lb.Append('Standard')
        codon_table_lb.Append('Vertebrate Mitochondrial')
        codon_table_lb.Append('Yeast Mitochondrial')
        codon_table_lb.Append('Mold Mitochondrial')
        codon_table_lb.Append('Invertebrate Mitochondrial')
        codon_table_lb.Append('Echinoderm Mitochondrial')
        codon_table_lb.Append('Euplotid Nuclear')
        codon_table_lb.Append('Bacterial')
        codon_table_lb.Append('Alternative Yeast Nuclear')
        codon_table_lb.Append('Ascidian Mitochondrial')
        codon_table_lb.Append('Flatworm Mitochondrial')
        codon_table_lb.Append('Blepharisma Macronuclear')
        codon_table_lb.SetSelection(0)

        transform_static = wx.StaticText(self,
                                         -1,
                                         'Transformation',
                                         style=wx.ALIGN_CENTER)
        lc = wx.LayoutConstraints()
        lc.top.Below(codon_table_lb, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.AsIs()
        lc.right.SameAs(self, wx.Right, 5)
        transform_static.SetConstraints(lc)

        transform_lb = wx.ListBox(self, ID_TRANSFORM)
        lc = wx.LayoutConstraints()
        lc.top.Below(transform_static, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.PercentOf(self, wx.Height, 30)
        lc.right.SameAs(self, wx.Right, 5)
        transform_lb.SetConstraints(lc)

        transform_lb.Append('Transcribe')
        transform_lb.Append('Translate')
        transform_lb.Append('Back transcribe')
        transform_lb.SetSelection(1)
        self.transform_lb = transform_lb
Exemple #7
0
    def ConstrainChildren(self, px, py):
        layout = wx.LayoutConstraints()
        layout.left.SameAs(self.m_container, wx.Left)
        layout.top.SameAs(self.m_container, wx.Top)

        if self.m_split == _DSR_HORIZONTAL_TAB:
            layout.right.SameAs(self.m_container, wx.Right)
            layout.height.PercentOf(self.m_container, wx.Height, py)
        else:
            layout.bottom.SameAs(self.m_container, wx.Bottom)
            layout.width.PercentOf(self.m_container, wx.Width, px)

        self.m_child[0].m_container.SetConstraints(layout)

        layout = wx.LayoutConstraints()
        layout.right.SameAs(self.m_container, wx.Right)
        layout.bottom.SameAs(self.m_container, wx.Bottom)

        if self.m_split == _DSR_HORIZONTAL_TAB:
            layout.top.Below(self.m_child[0].m_container, 1)
            layout.left.SameAs(self.m_container, wx.Left)
        else:
            layout.left.RightOf(self.m_child[0].m_container, 1)
            layout.top.SameAs(self.m_container, wx.Top)

        self.m_child[1].m_container.SetConstraints(layout)
Exemple #8
0
    def __init__(self, parent, width, buttons, Bottom=0):
        """Expects reference to 'parent' of 'ButtonColumn', button column 'width', list of button descriptor tuples, and number of buttons to be displayed at the bottom of the column.

		Each button descriptor consists of a label for the button and a reference to the function to be called when the button is clicked.
		"""
        wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, (100, 200))
        self.parent = parent
        """Create the upper collection of buttons"""
        previous = None
        imageFile = os.path.join(home, "images/editor_icon_16_2.png")
        image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        if 0:
            for button in buttons[0:len(buttons) - Bottom]:
                oneButton = bButton(self, button[0], button[1], button[2],
                                    button[3], image1)
                lc = wx.LayoutConstraints()
                lc.left.SameAs(self, wx.Left, 5)
                lc.right.SameAs(self, wx.Right, 5)
                lc.height.AsIs()
                if previous: lc.top.SameAs(previous, wx.Bottom, 5)
                else: lc.top.SameAs(self, wx.Top, 5)
                oneButton.SetConstraints(lc)
                previous = oneButton
            """Create the lower collection of buttons"""
            buttons.reverse()
            previous = None
            for button in buttons[0:Bottom]:
                oneButton = bButton(self, button[0], button[1], button[2],
                                    button[3], image1)
                lc = wx.LayoutConstraints()
                lc.left.SameAs(self, wx.Left, 5)
                lc.right.SameAs(self, wx.Right, 5)
                lc.height.AsIs()
                if previous: lc.bottom.SameAs(previous, wx.Top, 5)
                else: lc.bottom.SameAs(self, wx.Bottom, 5)
                oneButton.SetConstraints(lc)
                previous = oneButton
        button = buttons[0]
        oneTextCtrl = aTextCtrl(self,
                                button[0],
                                button[1],
                                button[2],
                                button[3],
                                style=wx.TE_PROCESS_ENTER)
        lc = wx.LayoutConstraints()
        lc.left.SameAs(self, wx.Left, 5)
        lc.right.SameAs(self, wx.Right, 5)
        lc.height.AsIs()
        oneTextCtrl.SetConstraints(lc)
Exemple #9
0
    def new_choice_box(self, label, layout, choices, default=0):
        """Create a choice box with label above it."""
        txt = wx.StaticText(self.panel, -1, label)

        # If we're using LayoutContraints ...
        if isinstance(layout, wx.LayoutConstraints):
            # ... apply the layout constraints that were passed in.
            txt.SetConstraints(layout)
        # If we're using Sizers ...
        elif isinstance(layout, wx.BoxSizer):
            # ... add the text label to the sizer that was passed in.
            layout.Add(txt, 0, wx.BOTTOM, 3)

        choice = wx.Choice(self.panel, -1, pos=wx.DefaultPosition, size=wx.DefaultSize, choices=choices)
        choice.SetSelection(default)

        # If we're using LayoutContraints ...
        if isinstance(layout, wx.LayoutConstraints):
            # ... create a new layout constraint just below the one passed in using its values
            lay = wx.LayoutConstraints()
            lay.top.Below(txt, 3)
            lay.left.SameAs(txt, wx.Left)
            lay.right.SameAs(txt, wx.Right)
            lay.height.AsIs()
            # Apply the layout constraint to the choice control.
            choice.SetConstraints(lay)
        # If we're using Sizers ...
        elif isinstance(layout, wx.BoxSizer):
            # ... add the choice control to the sizer.
            layout.Add(choice, 1, wx.EXPAND)

        # Add this choice control to the list of choice controls
        self.choices.append((label, choice))
        # Return the choice control
        return choice
Exemple #10
0
    def __init__(self,
                 parent,
                 id,
                 title,
                 size=(400, 230),
                 style=wx.DEFAULT_DIALOG_STYLE,
                 propagateEnabled=False,
                 useSizers=False,
                 HelpContext='Welcome'):
        self.width = size[0]
        self.height = size[1]
        # Remember if the Propagate Button should be displayed
        self.propagateEnabled = propagateEnabled
        # The HELPID for the Help Button is passed in as a parameter
        self.HelpContext = HelpContext
        wx.Dialog.__init__(self,
                           parent,
                           id,
                           title,
                           wx.DefaultPosition,
                           wx.Size(self.width, self.height),
                           style=style)

        # To look right, the Mac needs the Small Window Variant.
        if "__WXMAC__" in wx.PlatformInfo:
            self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        # Create a panel to hold the form contents.  This ensures that Tab Order works properly.
        self.panel = wx.Panel(self, -1, name='Dialog.Genform.Panel')
        # If we are using Sizers (and we are transitioning to Sizers)
        if useSizers:
            # Create a vertical sizer
            vSizer = wx.BoxSizer(wx.VERTICAL)
            # Create a horizontal sizer
            hSizer = wx.BoxSizer(wx.HORIZONTAL)
            # Add the panel to the horizontal sizer to expand horizontally
            hSizer.Add(self.panel, 1, wx.EXPAND)
            # Add the horizontal sizer to the vertical sizer to expand vertically.  Give it a 10 point margin all around.
            vSizer.Add(hSizer, 1, wx.EXPAND | wx.ALL, 10)
            # Set the vertical sizer as the form's main sizer.
            self.SetSizer(vSizer)
        # If we're using LayoutConstraints (which we're transitioning away from)
        else:
            # Create the Layout Constraint
            lay = wx.LayoutConstraints()
            # Set all margins to 0
            lay.top.SameAs(self, wx.Top, 0)
            lay.bottom.SameAs(self, wx.Bottom, 0)
            lay.left.SameAs(self, wx.Left, 0)
            lay.right.SameAs(self, wx.Right, 0)
            # Add these layout constraints to the panel.  (The items on the panel implement form margins under Layout Constaints.)
            self.panel.SetConstraints(lay)

            # We can create the buttons here with Layout Constraints, but not Sizers.
            self.create_buttons()

        # list of (label, widget) tuples
        self.edits = []
        self.choices = []
        self.combos = []
Exemple #11
0
    def __init__(self, parent, modTot=0, fileTot=0, extraStyle=0):
        self._init_ctrls(parent)

        addImagesToFS()

        self.moduleTotal = modTot
        self.fileTotal = fileTot

        self.blackback = wx.Window(self,
                                   -1,
                                   pos=(0, 0),
                                   size=self.GetClientSize(),
                                   style=wx.CLIP_CHILDREN)
        self.blackback.SetBackgroundColour(wx.BLACK)

        self.html = Utils.wxUrlClickHtmlWindow(
            self.blackback,
            -1,
            style=wx.CLIP_CHILDREN | wx.html.HW_NO_SELECTION | extraStyle)
        Utils.EVT_HTML_URL_CLICK(self.html, self.OnLinkClick)
        self.setPage()
        self.blackback.SetAutoLayout(True)
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self.blackback, wx.Top, self.border)
        lc.left.SameAs(self.blackback, wx.Left, self.border)
        lc.bottom.SameAs(self.blackback, wx.Bottom, self.border)
        lc.right.SameAs(self.blackback, wx.Right, self.border)
        self.html.SetConstraints(lc)
        self.blackback.Layout()
        self.Center(wx.BOTH)
        self.SetAcceleratorTable(
            wx.AcceleratorTable([(0, wx.WXK_ESCAPE, wx.ID_OK)]))
Exemple #12
0
class ireSignalSelect( wx.Dialog ):

	def __init__ (self, parent, id, title, taskManager):
	    #call the base class init method to create the dialog
		wx.Dialog.__init__(self, parent, id, title)

        self.taskManager = taskManager
        self.suffix = ''

        # For older versions of wxWidgets, wx.ExpandAll causes an assertion failure if wx.TR_HIDE_ROOT is specified.
        # This was fixed in wxWidgets ticket #4287, but I don't know the corresponding wxWindows version number.
        # It is known to fail with wxWindows 2.8.7.1, so we at least check for that.
        if wx.VERSION < (2,8,7,2):
            self.tree = wx.TreeCtrl(self, style = wx.TR_DEFAULT_STYLE)
        else:
            self.tree = wx.TreeCtrl(self, style = wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT)
        root = self.tree.AddRoot("TaskManager")
        self.AddTaskNodes(root, self.taskManager.GetNamesOfComponents(), self.taskManager.GetComponent)		
        self.tree.ExpandAll()

        self.OKButton = wx.Button(self, wx.ID_OK)
        self.CancelButton = wx.Button(self, wx.ID_CANCEL)

        lay = wx.LayoutConstraints()
        lay.top.SameAs(self, wx.Top, 10)         # Top margin of 10
        lay.bottom.SameAs(self, wx.Bottom, 85)   # Bottom margin of 35, to leave room for a button
        lay.left.SameAs(self, wx.Left, 10)       # Left margin of 10
        lay.right.SameAs(self, wx.Right, 10)     # Right margin of 10
        self.tree.SetConstraints(lay)

        lay = wx.LayoutConstraints()
        lay.top.SameAs(self, wx.Bottom, -30)     # Position the button at the bottom of the Dialog.
        lay.left.SameAs(self, wx.Left, 10  )
        lay.height.AsIs()
        lay.width.AsIs()
        self.OKButton.SetConstraints(lay)

        lay = wx.LayoutConstraints()
        lay.top.SameAs(self, wx.Bottom, -30)     # Position the button at the bottom of the Dialog.
        lay.right.SameAs(self, wx.Right, 10  )
        lay.height.AsIs()
        lay.width.AsIs()
        self.CancelButton.SetConstraints(lay)
        self.Layout()
        self.SetAutoLayout(True)
        self.shell = MyShell(self, pos=(10, self.tree.Size[1]+15), size=(self.tree.Size[0],50))
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemActivated)
Exemple #13
0
    def __init__(self,
                 parent,
                 size=None,
                 defaultsize=(420, 380),
                 name="",
                 caption=None,
                 **kwargs):

        # be sure to have a caption
        if caption is None:
            caption = name
        kwargs['name'] = name

        # use defaultsize if no size
        if size is None:
            size = defaultsize
        else:
            kwargs['size'] = size
        kwargs['defaultsize'] = defaultsize

        # init
        wx.Dialog.__init__(self, parent, -1, caption, style = wx.TAB_TRAVERSAL | wx.DEFAULT_DIALOG_STYLE, size = size)

        # container
        self.m_html = wxUrlClickHtmlWindow(self, -1, style = wx.CLIP_CHILDREN | wx.html.HW_SCROLLBAR_NEVER | wx.TAB_TRAVERSAL)
        EVT_HTML_URL_CLICK(self.m_html, self.OnLinkClick)

        # set the content
        apply(self.SetContents,(),kwargs)

        # layout the content
        self.SetAutoLayout(True)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.bottom.SameAs(self, wx.Bottom, 5)
        lc.right.SameAs(self, wx.Right, 5)
        self.m_html.SetConstraints(lc)
        self.Layout()

        self.GetDefaultItem().SetFocus()

        # from wxWindows docs: This function (wxWindow::OnCharHook) is
        # only relevant to top-level windows (frames and dialogs), and
        # under Windows only. Under GTK the normal EVT_CHAR_ event has
        # the functionality, i.e. you can intercepts it and if you
        # don't call wxEvent::Skip the window won't get the event.

        if sys.platform not in ["windows","nt"]:
            wx.EVT_CHAR_HOOK(self,self.OnCharHook)
        else:
            wx.EVT_CHAR(self,self.OnCharHook)
Exemple #14
0
    def test_layout(self):
        frame = self.frame
        panel = wx.Panel(frame)
        panel.BackgroundColour = 'blue'

        lc = wx.LayoutConstraints()
        lc.top.SameAs(frame, wx.Top, 10)
        lc.left.SameAs(frame, wx.Left, 10)
        lc.bottom.SameAs(frame, wx.Bottom, 10)
        lc.right.PercentOf(frame, wx.Right, 50)

        panel.SetConstraints(lc)
Exemple #15
0
    def __init__(self, toplevel, parent=None, id=-1):
        wx.Panel.__init__(self,
                          parent,
                          id,
                          style=wx.WANTS_CHARS | wx.CLIP_CHILDREN
                          | wx.NO_FULL_REPAINT_ON_RESIZE)
        self.toplevel = toplevel
        self.SetAutoLayout(True)
        self.toolbar = toolbar.ToolBar(self, -1)
        from gamera.gui import gamera_icons
        self.tree = RuleEngineRunnerTree(toplevel, self)
        self.toolbar.AddSimpleTool(10, gamera_icons.getIconUndoBitmap(),
                                   "Undo", self.tree._OnUndo)
        self.toolbar.AddSeparator()
        self.toolbar.AddSimpleTool(11, gamera_icons.getIconRefreshBitmap(),
                                   "Reload code", self.tree._OnReloadCode)
        self.toolbar.AddSeparator()
        self.toolbar.AddSimpleTool(12, gamera_icons.getIconSelectAddedBitmap(),
                                   "Select added glyphs",
                                   self.tree._OnSelectAdded)
        self.toolbar.AddSimpleTool(13,
                                   gamera_icons.getIconSelectRemovedBitmap(),
                                   "Select removed glyphs",
                                   self.tree._OnSelectRemoved)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 0)
        lc.left.SameAs(self, wx.Left, 0)
        lc.right.SameAs(self, wx.Right, 0)
        lc.height.AsIs()
        self.toolbar.SetAutoLayout(True)
        self.toolbar.SetConstraints(lc)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.toolbar, 0)
        lc.left.SameAs(self, wx.Left, 0)
        lc.right.SameAs(self, wx.Right, 0)
        lc.bottom.SameAs(self, wx.Bottom, 0)
        self.tree.SetAutoLayout(True)
        self.tree.SetConstraints(lc)
        self.Layout()
Exemple #16
0
 def __init__(self, parent):
     self._init_ctrls(parent)
     self.html = self.htmlWindow1
     parent.GetParent().html = self.html
     self.html.GoHome = self.GoHome
     self.Move(wx.Point(0, 0))
     cs = wx.LayoutConstraints()
     ref = self.GetParent()
     cs.top.SameAs(ref, wx.Top)
     cs.bottom.SameAs(ref, wx.Bottom)
     cs.left.SameAs(ref, wx.Left)
     cs.right.SameAs(ref, wx.Right)
     self.SetConstraints(cs)
     self.SetAutoLayout(True)
     cs = wx.LayoutConstraints()
     ref = self
     cs.top.SameAs(ref, wx.Top, 25)
     cs.bottom.SameAs(ref, wx.Bottom)
     cs.left.SameAs(ref, wx.Left)
     cs.right.SameAs(ref, wx.Right)
     self.html.SetConstraints(cs)
     self.html.SetAutoLayout(True)
Exemple #17
0
    def new_edit_box(self,
                     label,
                     layout,
                     def_text,
                     style=0,
                     ctrlHeight=40,
                     maxLen=0):
        """Create a edit box with label above it."""
        # The ctrlHeight parameter comes into play only when the wxTE_MULTILINE is used.
        # The default value of 40 is 2 text lines in height (or a little bit more.)

        # Create the text box's label
        txt = wx.StaticText(self.panel, -1, label)
        # If we're using LayoutContraints ...
        if isinstance(layout, wx.LayoutConstraints):
            # ... apply the layout constraints that were passed in.
            txt.SetConstraints(layout)
        # If we're using Sizers ...
        elif isinstance(layout, wx.BoxSizer):
            # ... add the text label to the sizer that was passed in.
            layout.Add(txt, 0, wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL, 3)
            layout.Add((10, 0))

        # Create the Text Control
        edit = wx.TextCtrl(self.panel, -1, def_text, style=style)
        # If a maximum length is specified, apply it.  (I don't think this is supported under unicode!!)
        if maxLen > 0:
            edit.SetMaxLength(maxLen)

        # If we're using LayoutContraints ...
        if isinstance(layout, wx.LayoutConstraints):
            # ... create a new layout constraint just below the one passed in using its values
            lay = wx.LayoutConstraints()
            lay.top.Below(txt, 3)
            lay.left.SameAs(txt, wx.Left)
            lay.right.SameAs(txt, wx.Right)
            if style == 0:
                lay.height.AsIs()
            else:
                lay.height.Absolute(ctrlHeight)
            # Apply the layout constraint to the text control.
            edit.SetConstraints(lay)
        # If we're using Sizers ...
        elif isinstance(layout, wx.BoxSizer):
            # ... add the text control to the sizer.
            layout.Add(edit, 1, wx.EXPAND)

        # Add this text control to the list of edit controls
        self.edits.append((label, edit))
        # Return the text control
        return edit
Exemple #18
0
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize)

        self.drawingarea = MyDrawingArea(self, -1)

        self.SetAutoLayout(True)

        gap = 30 #in pixels
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, gap)
        lc.left.SameAs(self, wx.Left, gap)
        lc.right.SameAs(self, wx.Width, gap)
        lc.bottom.SameAs(self, wx.Bottom, gap)
        self.drawingarea.SetConstraints(lc)
Exemple #19
0
    def new_combo_box(self, label, layout, choices, default='', style=None):
        """Create a combo box with label above it."""
        if style == None:
            # As of wxPython 2.9.5.0, Mac doesn't support wx.CB_SORT and gives an ugly message about it!
            if 'wxMac' in wx.PlatformInfo:
                style = wx.CB_DROPDOWN
                choices.sort()
            else:
                style = wx.CB_DROPDOWN | wx.CB_SORT

        txt = wx.StaticText(self.panel, -1, label)

        # If we're using LayoutContraints ...
        if isinstance(layout, wx.LayoutConstraints):
            # ... apply the layout constraints that were passed in.
            txt.SetConstraints(layout)
        # If we're using Sizers ...
        elif isinstance(layout, wx.BoxSizer):
            # ... add the text label to the sizer that was passed in.
            layout.Add(txt, 0, wx.BOTTOM, 3)

        combo = wx.ComboBox(self.panel,
                            -1,
                            pos=wx.DefaultPosition,
                            size=wx.DefaultSize,
                            choices=choices,
                            style=style)
        combo.SetValue(default)

        # If we're using LayoutContraints ...
        if isinstance(layout, wx.LayoutConstraints):
            # ... create a new layout constraint just below the one passed in using its values
            lay = wx.LayoutConstraints()
            lay.top.Below(txt, 3)
            lay.left.SameAs(txt, wx.Left)
            lay.right.SameAs(txt, wx.Right)
            lay.height.AsIs()
            # Apply the layout constraint to the combo control.
            combo.SetConstraints(lay)
        # If we're using Sizers ...
        elif isinstance(layout, wx.BoxSizer):
            # ... add the combo control to the sizer.
            layout.Add(combo, 1, wx.EXPAND)

        # Add this combo control to the list of combo controls
        self.combos.append((label, combo))
        # Return the combo control
        return combo
Exemple #20
0
        def __init__(self):
            wx.Frame.__init__(self,
                              None,
                              -1,
                              "Button Column Test",
                              size=(450, 300),
                              style=wx.DEFAULT_FRAME_STYLE
                              | wx.NO_FULL_REPAINT_ON_RESIZE)
            self.SetAutoLayout(True)
            buttons = [
                (
                    'OK',
                    self.OKClicked,
                    self.OnMessage,
                    'OK button text1',
                ),
                (
                    'Cancel',
                    self.CancelClicked,
                    self.OnMessage,
                    'Cancel button text',
                ),
                (
                    'Re-invert',
                    self.ReinvertClicked,
                    self.OnMessage,
                    'Re-invert button text',
                ),
                (
                    'Exit',
                    self.ExitClicked,
                    self.OnMessage,
                    'Exit button text',
                ),
            ]

            self.tp = ButtonColumn(self, 45, buttons, 2)

            lc = wx.LayoutConstraints()
            lc.right.SameAs(self, wx.Right)
            lc.width.AsIs()
            lc.top.SameAs(self, wx.Top)
            lc.bottom.SameAs(self, wx.Bottom)
            self.tp.SetConstraints(lc)

            self.CreateStatusBar()
Exemple #21
0
    def __init__(self, parent, id, log, galaxy):
        wx.Panel.__init__(self, parent)
        self.selectedID = ''
        self.galaxy = galaxy
        self.SetAutoLayout(True)
        self.SetBackgroundColour("DARK GREEN")

        self.mainGrid = gridControl.GridControlParent(
            self, log, anwp.war.regiment.Regiment({}), 1)
        self.mainGrid.loadData(galaxy.regiments, 1)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        self.mainGrid.SetConstraints(lc)
Exemple #22
0
 def OnTonotebookButton(self, event):
     self.panel.Reparent(self.parent.notebook1.GetPage(self.nbselection))
     self.parent.notebook1.GetPage(self.nbselection).Show(1)
     self.parent.notebook1.SetSelection(self.nbselection)
     self.panel.Move(wx.Point(0,0))
     cs = wx.LayoutConstraints()
     ref=self.parent.notebook1.GetPage(self.nbselection)
     cs.top.SameAs(ref,wx.Top)
     cs.bottom.SameAs(ref,wx.Bottom)
     cs.left.SameAs(ref,wx.Left)
     cs.right.SameAs(ref,wx.Right)
     self.panel.SetConstraints(cs)
     self.panel.SetAutoLayout(True)
     self.panel.SetSize(self.parent.notebook1.GetSize())
     self.parent.Refresh()
     self.panel.Refresh()
     self.parent.notebook1.Update()
     self.Destroy()
     event.Skip()
Exemple #23
0
 def __init__(self,
              parent,
              id,
              pos=wx.DefaultPosition,
              size=wx.DefaultSize):
     wx.Panel.__init__(self,
                       id=id,
                       parent=parent,
                       pos=pos,
                       size=size,
                       style=wx.TAB_TRAVERSAL)
     # creat Gauge
     self.gauge = Gauge(self, id=-1, size=size)
     self.SetAutoLayout(True)
     lc = wx.LayoutConstraints()
     lc.top.SameAs(self, wx.Top, 0)  # AsIs()
     lc.left.AsIs()
     lc.height.AsIs()
     lc.right.SameAs(self, wx.Right, 0)
     self.gauge.SetConstraints(lc)
Exemple #24
0
    def __init__(self, prnt):
        wx.Dialog.__init__(self,
                           size=wx.Size(480, 525),
                           pos=(-1, -1),
                           id=wxID_ABOUTBOX,
                           title=message('about_title'),
                           parent=prnt,
                           name='AboutBox',
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.blackback = wx.Window(self,
                                   -1,
                                   pos=(0, 0),
                                   size=self.GetClientSize(),
                                   style=wx.CLIP_CHILDREN)
        self.blackback.SetBackgroundColour(wx.BLACK)

        self.m_html = wxUrlClickHtmlWindow(self.blackback,
                                           -1,
                                           style=wx.CLIP_CHILDREN
                                           | wx.html.HW_NO_SELECTION)
        EVT_HTML_URL_CLICK(self.m_html, self.OnLinkClick)

        self.setPage()
        self.blackback.SetAutoLayout(True)

        # adjust constraints
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self.blackback, wx.Top, self.border)
        lc.left.SameAs(self.blackback, wx.Left, self.border)
        lc.bottom.SameAs(self.blackback, wx.Bottom, self.border)
        lc.right.SameAs(self.blackback, wx.Right, self.border)
        self.m_html.SetConstraints(lc)

        # layout everything
        self.blackback.Layout()
        self.Center(wx.BOTH)

        #
        self.SetAcceleratorTable(
            wx.AcceleratorTable([(0, wx.WXK_ESCAPE, wx.ID_OK)]))
Exemple #25
0
    def __init__(self, parent, log):
        self.parent = parent
        wx.Panel.__init__(self, parent, -1)
        apply_button = wx.Button(self, ID_APPLY, "Apply")
        clear_button = wx.Button(self, ID_CLEAR, "Clear")
        close_button = wx.Button(self, ID_CLOSE, "Close")
        wx.EVT_BUTTON(self, ID_CLOSE, self.OnClose)
        wx.EVT_BUTTON(self, ID_APPLY, self.OnApply)
        wx.EVT_BUTTON(self, ID_CLEAR, self.OnClear)

        lc = wx.LayoutConstraints()
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.height.AsIs()
        lc.width.PercentOf(self, wx.Width, 25)
        apply_button.SetConstraints(lc)

        lc = wx.LayoutConstraints()
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.left.RightOf(apply_button, 5)
        lc.height.AsIs()
        lc.width.PercentOf(self, wx.Width, 25)
        clear_button.SetConstraints(lc)

        lc = wx.LayoutConstraints()
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.left.RightOf(clear_button, 5)
        lc.height.AsIs()
        lc.width.PercentOf(self, wx.Width, 25)
        close_button.SetConstraints(lc)

        src_static = wx.StaticText(self,
                                   -1,
                                   'Original Sequence',
                                   style=wx.ALIGN_CENTER)
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.AsIs()
        lc.right.SameAs(self, wx.Right, 5)
        src_static.SetConstraints(lc)

        src_text = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE)
        lc = wx.LayoutConstraints()
        lc.top.Below(src_static, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.PercentOf(self, wx.Height, 30)
        lc.right.SameAs(self, wx.Right, 5)
        src_text.SetConstraints(lc)
        self.src_text = src_text

        dest_static = wx.StaticText(self,
                                    -1,
                                    'Transformed Sequence',
                                    style=wx.ALIGN_CENTER)
        lc = wx.LayoutConstraints()
        lc.top.Below(src_text, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.AsIs()
        lc.right.SameAs(self, wx.Right, 5)
        dest_static.SetConstraints(lc)

        dest_text = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE)
        lc = wx.LayoutConstraints()
        lc.top.Below(dest_static, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.height.PercentOf(self, wx.Height, 30)
        lc.right.SameAs(self, wx.Right, 5)
        dest_text.SetConstraints(lc)
        self.dest_text = dest_text
    def __init__(self, parent):
        """ Initialize the Batch Waveform Generator form """
        Dialogs.GenForm.__init__(self,
                                 parent,
                                 -1,
                                 _('Batch Waveform Generator'), (500, 550),
                                 style=wx.DEFAULT_DIALOG_STYLE
                                 | wx.RESIZE_BORDER,
                                 HelpContext='Batch Waveform Generator')

        # To look right, the Mac needs the Small Window Variant.
        if "__WXMAC__" in wx.PlatformInfo:
            self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        # Define the minimum size for this dialog as the initial size
        self.SetSizeHints(500, 500)

        if TransanaGlobal.configData.videoPath <> '':
            self.lastPath = TransanaGlobal.configData.videoPath
        else:
            self.lastPath = os.path.dirname(sys.argv[0])

        # Create the controls that will populate the BatchWaveformGenerator window.
        browse = wx.Button(self.panel, wx.ID_FILE1, _("Select Files"),
                           wx.DefaultPosition)
        directories = wx.Button(self.panel, wx.ID_FILE2, _("Select Directory"),
                                wx.DefaultPosition)
        label = wx.StaticText(self.panel, -1, _('Selected Files:'))
        self.fileList = wx.ListBox(self.panel, -1, style=wx.LB_MULTIPLE)
        self.overwrite = wx.CheckBox(self.panel, -1,
                                     _('Overwrite existing wave files?'))
        remfile = wx.Button(self.panel, wx.ID_FILE3,
                            _("Remove Selected File(s)"), wx.DefaultPosition)

        # Bind the events that we'll need.
        wx.EVT_BUTTON(self, wx.ID_FILE1, self.OnBrowse)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.BrowseDirectories)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.RemoveSelected)

        # Browse button layout
        lay = wx.LayoutConstraints()
        lay.top.SameAs(self.panel, wx.Top, 10)
        lay.left.SameAs(self.panel, wx.Left, 10)
        lay.width.PercentOf(self.panel, wx.Width, 46)
        lay.height.AsIs()
        browse.SetConstraints(lay)

        # dirdialog button layout
        lay = wx.LayoutConstraints()
        lay.top.SameAs(self.panel, wx.Top, 10)
        lay.right.SameAs(self.panel, wx.Right, 10)
        lay.width.PercentOf(self.panel, wx.Width, 46)
        lay.height.AsIs()
        directories.SetConstraints(lay)

        # Place the label for the forthcoming file list.

        # 500-2*(margin_sizes=10)=480 - width of label
        # this provides us with a "good enough" number of pixels to
        # use so that we can indent the label properly.
        rightpos = 480 - label.GetBestSizeTuple()[0]
        lay = wx.LayoutConstraints()
        lay.top.Below(directories, 12)
        lay.left.SameAs(self.panel, wx.Left, 10)
        lay.right.SameAs(self.panel, wx.Right, rightpos)
        lay.height.AsIs()
        label.SetConstraints(lay)

        # place an option to overwrite existing wave files to the upper-right
        # of the ListBox.

        # 500-2*(margin_sizes=10)=480 - width of checkbox
        # this provides us with a "good enough" number of pixels to
        # use so that we can indent the CheckBox properly.
        leftpos = 480 - self.overwrite.GetBestSizeTuple()[0]
        lay = wx.LayoutConstraints()
        lay.top.Below(directories, 12)
        lay.right.SameAs(self.panel, wx.Right, 10)
        lay.left.SameAs(self.panel, wx.Left, leftpos)
        lay.height.AsIs()
        self.overwrite.SetConstraints(lay)

        # place the actual ListBox.
        lay = wx.LayoutConstraints()
        lay.top.Below(label, 2)
        lay.left.SameAs(self.panel, wx.Left, 10)
        lay.right.SameAs(self.panel, wx.Right, 10)
        lay.bottom.SameAs(self.panel, wx.Bottom, 50)
        self.fileList.SetConstraints(lay)

        # place the remove file button!
        lay = wx.LayoutConstraints()
        lay.top.Below(self.fileList, 17)
        lay.left.SameAs(self.panel, wx.Left, 10)
        lay.width.AsIs()
        lay.height.AsIs()
        remfile.SetConstraints(lay)

        self.Layout()
        self.SetAutoLayout(True)
        self.CenterOnScreen()
Exemple #27
0
    def create_buttons(self, gap=10, sizer=None):
        """Create the dialog buttons."""
        # We don't want to use wx.ID_HELP here, as that causes the Help buttons to be replaced with little question
        # mark buttons on the Mac, which don't look good.
        ID_HELP = wx.NewId()

        # If we're using a Sizer (not LayoutConstraints)
        if sizer:
            # ... add an expandable spacer here so buttons will be right-justified
            sizer.Add((1, 0), 1, wx.EXPAND)

        # If the Propagation feature is enabled ...
        if self.propagateEnabled:
            # ... load the propagate button graphic
            propagateBMP = TransanaImages.Propagate.GetBitmap()
            # Create a bitmap button for propagation
            self.propagate = wx.BitmapButton(self.panel, -1, propagateBMP)
            # Set the tool tip for the graphic button
            self.propagate.SetToolTipString(_("Propagate Changes"))
            # Bind the propogate button to its event
            self.propagate.Bind(wx.EVT_BUTTON, self.OnPropagate)

            # If we're using Layout Constraints ...
            if sizer == None:
                # Position the Propagate button on screen
                lay = wx.LayoutConstraints()
                lay.height.AsIs()
                lay.bottom.SameAs(self.panel, wx.Bottom, 10)
                lay.right.SameAs(self.panel, wx.Right, 265)
                lay.width.AsIs()
                self.propagate.SetConstraints(lay)
            # If we're using Sizers ...
            else:
                # ... add the propagate button to the sizer
                sizer.Add(self.propagate, 0, wx.ALIGN_RIGHT | wx.EXPAND)

        # Define the standard buttons we want to create.
        # Tuple format = (label, id, make default?, indent from right)
        buttons = ((_("OK"), wx.ID_OK, 1, 180), (_("Cancel"), wx.ID_CANCEL, 0,
                                                 95), (_("Help"), ID_HELP, 0,
                                                       gap))

        for b in buttons:
            # If we're using Layout Constraints:
            if sizer == None:
                lay = wx.LayoutConstraints()
                lay.height.AsIs()
                lay.bottom.SameAs(self.panel, wx.Bottom, 10)
                lay.right.SameAs(self.panel, wx.Right, b[3])
                lay.width.AsIs()
            button = wx.Button(self.panel, b[1], b[0])
            # If we're using Layout Constraints:
            if sizer == None:
                button.SetConstraints(lay)
            else:
                sizer.Add(button, 0, wx.ALIGN_RIGHT | wx.LEFT | wx.EXPAND, gap)

            if b[2]:
                button.SetDefault()
        # If Mac ...
        if 'wxMac' in wx.PlatformInfo:
            # ... add a spacer to avoid control clipping
            sizer.Add((2, 0))

        wx.EVT_BUTTON(self, ID_HELP, self.OnHelp)
Exemple #28
0
    def Create(self):
        self.m_hscroll = wx.ScrollBar()
        self.m_vscroll = wx.ScrollBar()
        self.m_viewport = wx.Window()

        add_child_target = self.m_impl.m_add_child_target
        self.m_impl.m_add_child_target = None

        success = self.m_hscroll.Create(self.m_impl.m_container, style=wx.SB_HORIZONTAL)
        if success:
            success = self.m_vscroll.Create(self.m_impl.m_container, style=wx.SB_VERTICAL)
        if success:
            success = self.m_viewport.Create(self.m_impl.m_container)

        if not success:
            return False

        self.m_impl.m_add_child_target = add_child_target

        cursor = wx.Cursor(wx.CURSOR_ARROW)
        self.m_hscroll.SetCursor(cursor)
        self.m_vscroll.SetCursor(cursor)
        self.m_viewport.SetCursor(cursor)

        self.m_viewport.Bind(wx.EVT_SIZE, self.OnViewSize)
        self.Bind(_EVT_DYNAMIC_SASH_REPARENT, self.OnReparent)

        if self.m_impl.m_window.GetWindowStyle() & DS_MANAGE_SCROLLBARS:
            for sbar in [self.m_hscroll, self.m_vscroll]:
                sbar.Bind(wx.EVT_SET_FOCUS, self.OnFocus)
                sbar.Bind(wx.EVT_SCROLL_TOP, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_BOTTOM, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_LINEUP, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_LINEDOWN, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_PAGEUP, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_PAGEDOWN, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_THUMBTRACK, self.OnScroll)
                sbar.Bind(wx.EVT_SCROLL_THUMBRELEASE, self.OnScroll)

        layout = wx.LayoutConstraints()
        size = self.m_hscroll.GetBestSize()

        layout.left.SameAs(self.m_impl.m_container, wx.Left, 10)
        layout.right.LeftOf(self.m_vscroll)
        layout.bottom.SameAs(self.m_impl.m_container, wx.Bottom, 3)
        layout.height.Absolute(size.GetHeight())
        self.m_hscroll.SetConstraints(layout)

        layout = wx.LayoutConstraints()
        size = self.m_vscroll.GetBestSize()

        layout.top.SameAs(self.m_impl.m_container, wx.Top, 10)
        layout.bottom.Above(self.m_hscroll)
        layout.right.SameAs(self.m_impl.m_container, wx.Right, 3)
        layout.width.Absolute(size.GetWidth())
        self.m_vscroll.SetConstraints(layout)

        layout = wx.LayoutConstraints()
        layout.left.SameAs(self.m_impl.m_container, wx.Left, 3)
        layout.right.LeftOf(self.m_vscroll)
        layout.top.SameAs(self.m_impl.m_container, wx.Top, 3)
        layout.bottom.Above(self.m_hscroll)
        self.m_viewport.SetConstraints(layout)

        self.m_impl.m_container.Layout()
        return True
    def __init__(self, parent, id):

        wx.Frame.__init__(self, parent, id, "KNIT TPO", size=(1000, 700))

        self.Maximize(True)
        self.SetAutoLayout(True)

        self.font = wx.Font(16, wx.SWISS, wx.NORMAL, wx.BOLD)

        self.panelA = scrolled.ScrolledPanel(self,
                                             -1,
                                             style=wx.TAB_TRAVERSAL
                                             | wx.SUNKEN_BORDER,
                                             name="panelA")
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 37)
        lc.right.PercentOf(self, wx.Right, 51)
        self.panelA.SetConstraints(lc)
        self.panelA.SetupScrolling()

        self.panelB = scrolled.ScrolledPanel(self,
                                             -1,
                                             style=wx.TAB_TRAVERSAL
                                             | wx.SUNKEN_BORDER,
                                             name="panelB")
        lc = wx.LayoutConstraints()
        lc.top.Below(self.panelA, 7)
        lc.right.PercentOf(self, wx.Right, 51)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.left.SameAs(self, wx.Left, 10)
        self.panelB.SetConstraints(lc)
        self.panelB.SetupScrolling()

        self.panelC = scrolled.ScrolledPanel(self,
                                             -1,
                                             style=wx.TAB_TRAVERSAL
                                             | wx.SUNKEN_BORDER,
                                             name="panelC")
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 37)
        lc.left.RightOf(self.panelA, 7)
        self.panelC.SetConstraints(lc)
        self.panelC.SetupScrolling()

        self.panelE = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.panelC, 7)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.SameAs(self, wx.Bottom, 140)
        lc.left.RightOf(self.panelA, 7)
        self.panelE.SetConstraints(lc)

        self.panelD = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.panelE, 7)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.left.RightOf(self.panelB, 7)
        self.panelD.SetConstraints(lc)

        self.Fit()
        self.SetMinSize((1000, 700))

        self.e1b = wx.Button(self.panelA,
                             label="Precise Sheet",
                             pos=(1, 225),
                             size=(136.8, 22))
        self.e2b = wx.Button(self.panelA,
                             label="CarryOvers Sheet",
                             pos=(136.8, 225),
                             size=(138, 22))
        self.e3b = wx.Button(self.panelA,
                             label="Detailed Sheet",
                             pos=(273.6, 225),
                             size=(138, 22))
        self.e4b = wx.Button(self.panelA,
                             label="Branch Changers",
                             pos=(410.4, 225),
                             size=(138, 22))
        self.e5b = wx.Button(self.panelA,
                             label="UFM",
                             pos=(547.2, 225),
                             size=(136.8, 22))
        self.Bind(wx.EVT_BUTTON, self.onE1b, self.e1b)
        self.Bind(wx.EVT_BUTTON, self.onE2b, self.e2b)
        self.Bind(wx.EVT_BUTTON, self.onE3b, self.e3b)
        self.Bind(wx.EVT_BUTTON, self.onE4b, self.e4b)
        self.Bind(wx.EVT_BUTTON, self.onE5b, self.e5b)
        self.e1b.Enable(False)

        self.ExportData(1)
        self.ImportData()
        self.MergeData()
        self.BroadcastMessage()
        self.MainPanel()

        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemple #30
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)
        self.SetAutoLayout(True)
        self.Bind(wx.EVT_BUTTON, self.OnButton, id=100)

        self.SetBackgroundColour(wx.Colour("MEDIUM ORCHID"))

        self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        self.panelA.SetBackgroundColour(wx.BLUE)

        txt = wx.StaticText(
            self.panelA, -1, "Resize the window and see\n"
            "what happens...  Notice that\n"
            "there is no OnSize handler.", (5, 5), (-1, 50))

        txt.SetBackgroundColour(wx.BLUE)
        txt.SetForegroundColour(wx.WHITE)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.left.SameAs(self, wx.Left, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.right.PercentOf(self, wx.Right, 50)
        self.panelA.SetConstraints(lc)

        self.panelB = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        self.panelB.SetBackgroundColour(wx.RED)
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.PercentOf(self, wx.Bottom, 30)
        lc.left.RightOf(self.panelA, 10)
        self.panelB.SetConstraints(lc)

        self.panelC = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        self.panelC.SetBackgroundColour(wx.WHITE)
        lc = wx.LayoutConstraints()
        lc.top.Below(self.panelB, 10)
        lc.right.SameAs(self, wx.Right, 10)
        lc.bottom.SameAs(self, wx.Bottom, 10)
        lc.left.RightOf(self.panelA, 10)
        self.panelC.SetConstraints(lc)

        b = wx.Button(self.panelA, 100, ' Panel A ')
        lc = wx.LayoutConstraints()
        lc.centreX.SameAs(self.panelA, wx.CentreX)
        lc.centreY.SameAs(self.panelA, wx.CentreY)
        lc.height.AsIs()
        lc.width.PercentOf(self.panelA, wx.Width, 50)
        b.SetConstraints(lc)

        b = wx.Button(self.panelB, 100, ' Panel B ')
        lc = wx.LayoutConstraints()
        lc.top.SameAs(self.panelB, wx.Top, 2)
        lc.right.SameAs(self.panelB, wx.Right, 4)
        lc.height.AsIs()
        lc.width.AsIs()
        b.SetConstraints(lc)

        self.panelD = wx.Window(self.panelC, -1, style=wx.SIMPLE_BORDER)
        self.panelD.SetBackgroundColour(wx.GREEN)
        wx.StaticText(self.panelD, -1, "Panel D",
                      (4, 4)).SetBackgroundColour(wx.GREEN)

        b = wx.Button(self.panelC, 100, ' Panel C ')
        lc = wx.LayoutConstraints()
        lc.top.Below(self.panelD)
        lc.left.RightOf(self.panelD)
        lc.height.AsIs()
        lc.width.AsIs()
        b.SetConstraints(lc)

        lc = wx.LayoutConstraints()
        lc.bottom.PercentOf(self.panelC, wx.Height, 50)
        lc.right.PercentOf(self.panelC, wx.Width, 50)
        lc.height.SameAs(b, wx.Height)
        lc.width.SameAs(b, wx.Width)
        self.panelD.SetConstraints(lc)