Пример #1
0
    def childCreator(self, bCounter, progressDlg):
        """
        Функция создает объекты, которые содержаться в данном компоненте.
        """
        if self.child:
            if not self.evalSpace['_root_obj']:
                self.evalSpace['_root_obj'] = self

            self.GetKernel().parse_resource(self,
                                            self.child,
                                            None,
                                            context=self.evalSpace,
                                            bCounter=bCounter,
                                            progressDlg=progressDlg)

        if not self.resource['win1']:
            win1 = wx.Window(self, -1)
        else:
            win1 = self.components[self.resource['win1']['name']]

        if not self.resource['win2']:
            win2 = wx.Window(self, -1)
        else:
            win2 = self.components[self.resource['win2']['name']]

        if self.layout == 'vertical':
            self.SplitVertically(win1, win2, self.sash_pos)
        else:
            self.SplitHorizontally(win1, win2, self.sash_pos)
Пример #2
0
        def __init__(self, parent):
            wx.Frame.__init__(self, parent, -1, 'Test Layout Constraints',
                              wx.DefaultPosition, (500, 300))
            self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

            self.SetAutoLayout(True)

            self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
            self.panelA.SetBackgroundColour(wx.BLUE)
            self.panelA.SetConstraints(Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1',(self,)))

            self.panelB = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
            self.panelB.SetBackgroundColour(wx.RED)
            self.panelB.SetConstraints(Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2', (self,self.panelA)))

            self.panelC = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
            self.panelC.SetBackgroundColour(wx.WHITE)
            self.panelC.SetConstraints(Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self,self.panelA,self.panelB)))

            b = wx.Button(self.panelA, -1, ' About: ')
            b.SetConstraints(Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
            self.Bind(wx.EVT_BUTTON, self.OnAbout, b)

            b = wx.Button(self.panelB, 100, ' Panel B ')
            b.SetConstraints(Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))

            self.panelD = wx.Window(self.panelC, -1, style=wx.SIMPLE_BORDER)
            self.panelD.SetBackgroundColour(wx.GREEN)
            self.panelD.SetConstraints(Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b)))

            b = wx.Button(self.panelC, -1, ' Panel C ')
            b.SetConstraints(Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
            self.Bind(wx.EVT_BUTTON, self.OnButton, b)

            wx.StaticText(self.panelD, -1, "Panel D", (4, 4)).SetBackgroundColour(wx.GREEN)
Пример #3
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize)

        h = 40
        wwhite = wx.Window(self, -1, (-1, -1), (-1, h), wx.SIMPLE_BORDER)
        wwhite.SetBackgroundColour(wx.WHITE)
        wblue = ColWin(self, -1, wx.BLUE)
        wgreen = ColWin(self, -1, wx.GREEN)
        wred = wx.Window(self, -1, (-1, -1), (-1, h), wx.SIMPLE_BORDER)
        wred.SetBackgroundColour(wx.RED)

        hgap, vgap = 0, 0
        nrows, ncols = 3, 3
        fgs = wx.FlexGridSizer(nrows, ncols, hgap, vgap)

        b = 5
        fgs.AddMany([
            ((-1, -1), 1, wx.EXPAND | wx.ALL, b),
            (wwhite, 1, wx.EXPAND | wx.ALL, b),
            ((-1, -1), 1, wx.EXPAND | wx.ALL, b),
            (wblue, 1, wx.EXPAND | wx.ALL, b),
            ((-1, -1), 1, wx.EXPAND | wx.ALL, b),
            (wgreen, 1, wx.EXPAND | wx.ALL, b),
            ((-1, -1), 1, wx.EXPAND | wx.ALL, b),
            (wred, 1, wx.EXPAND | wx.ALL, b),
            ((-1, -1), 1, wx.EXPAND | wx.ALL, b),
        ])

        fgs.AddGrowableRow(1)

        fgs.AddGrowableCol(0)
        fgs.AddGrowableCol(1)
        fgs.AddGrowableCol(2)

        self.SetSizer(fgs)
Пример #4
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, "Simple", size=(300, 200))
        statusBar = self.CreateStatusBar()
        menuBar = wx.MenuBar()
        menu1 = wx.Menu()
        menuBar.Append(menu1, "&File")
        menu2 = wx.Menu()
        menu2.Append(wx.NewId(), "&Copy", "status information")
        menu2.Append(wx.NewId(), "C&ut", "")
        menu2.Append(wx.NewId(), "Paste", "")
        menu2.AppendSeparator()
        menu2.Append(wx.NewId(), "&Options", "Display Options")
        menuBar.Append(menu2, "&Edit")
        menu3 = wx.Menu()
        menuItem = menu3.Append(wx.NewId(), "&About", "About this software")
        self.Bind(wx.EVT_MENU, self.OnAbout, menuItem)
        menuBar.Append(menu3, "&Help")
        self.SetMenuBar(menuBar)

        splitter = wx.SplitterWindow(self, -1, style=wx.SP_LIVE_UPDATE)
        sty = wx.BORDER_SUNKEN
        p1 = wx.Window(splitter, style=sty)
        p1.SetBackgroundColour("pink")
        wx.StaticText(p1, -1, "Panel One", (5, 5))

        p2 = wx.Window(splitter, style=sty)
        p2.SetBackgroundColour("sky blue")
        wx.StaticText(p2, -1, "Panel Two", (5, 5))

        splitter.SetMinimumPaneSize(20)
        splitter.SplitVertically(p1, p2, -100)

        toolbar = self.CreateToolBar(wx.TB_TEXT | wx.TB_HORZ_LAYOUT
                                     | wx.TB_NO_TOOLTIPS)
Пример #5
0
    def __makeSizers(self):
        """Lay out the interactors"""

        nrow = 9
        ncol = 4
        padx = 5
        pady = 5
        self.fgsizer = wx.FlexGridSizer(nrow, ncol, padx,
                                        pady)  # m x n, paddings
        self.fgsizer.AddGrowableCol(2, 1)
        self.fgsizer.AddGrowableCol(3, 1)
        #self.fgsizer.AddGrowableRow(num, proportion)
        self.fgsizer.Add(self.curr_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.rdrs_cho, 0, wx.ALIGN_RIGHT)
        #self.fgsizer.Add(self.save_but, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(self.new_but, 0, wx.ALIGN_RIGHT)

        self.fgsizer.Add(self.name_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.name_txt, 0, wx.EXPAND)

        self.fgsizer.Add(self.mode_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.mode_cho, 0, wx.ALIGN_RIGHT)

        self.fgsizer.Add(self.agg_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.agg_cho, 0, wx.EXPAND | wx.ALIGN_CENTER)

        self.fgsizer.Add(self.files_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.AddSpacer(1)
        self.fgsizer.Add(self.dir_but, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(self.img_but, 0, wx.ALIGN_RIGHT)

        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.read_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.read_but, 0, wx.ALIGN_RIGHT)

        self.fgsizer.Add(wx.Window(self, -1), 0, wx.EXPAND | wx.ALIGN_CENTER)
        self.fgsizer.Add(self.browse_lab, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(self.browse_spn, 0, wx.ALIGN_RIGHT)
        self.fgsizer.Add(self.browse_inf, 0, wx.ALIGN_CENTER | wx.EXPAND)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.tbarSizer, 0,
                       wx.EXPAND | wx.ALIGN_CENTER | wx.BOTTOM, 10)
        self.sizer.Add(self.fgsizer, 0, wx.EXPAND | wx.ALIGN_RIGHT)

        self.sizer.Add(self.sp_single, 0, wx.EXPAND | wx.ALIGN_RIGHT)
        self.sizer.Add(self.sp_multi, 0, wx.EXPAND | wx.ALIGN_RIGHT)

        self.sizer.Add(self.sp_info, 0, wx.EXPAND | wx.ALIGN_RIGHT)

        return
Пример #6
0
 def testTopLevelParent(self):
     """GetTopLevelParent"""
     parent = wx.Frame(None)
     one = wx.Window(parent)
     two = wx.Window(one)
     three = wx.Window(two)
     four = wx.Window(three)
     self.assertEquals(parent, four.GetTopLevelParent())
Пример #7
0
 def testGetChildren(self):
     """GetChildren"""
     # segfaults on Ubuntu for unknown reason
     if wxtest.PlatformIsNotGtk():
         a = wx.Window(self.testControl)
         b = wx.Window(self.testControl)
         c = wx.Window(self.testControl)
         for child in (a,b,c):
             self.assert_(child in self.testControl.GetChildren())
Пример #8
0
    def __init__(self, parent, connection):
        ESB.EnhancedStatusBar.__init__(self, parent)
        self.parent = parent
        self.connection = connection

        # status field
        self.status_field = wx.Panel(self)

        # "feature icons" container
        self.feature_tray = wx.Window(self)
        self.feature_sizer = wx.BoxSizer()
        self.feature_icons = {}
        for i, w in icons.items():
            icon = FeatureIcon(self.feature_tray, i, w)
            self.feature_sizer.Add(icon, 0, wx.EXPAND | wx.SHAPED)
            icon.Hide()
            self.feature_icons[i] = icon
        self.feature_tray.SetSizerAndFit(self.feature_sizer)

        # connected-time widget
        self.conn_time = wx.StaticText(self,
                                       label="--:--:--:--",
                                       style=wx.ALIGN_CENTER_HORIZONTAL)

        # "connection status" light
        self.conn_status = wx.Window(self)
        self.conn_status.SetBackgroundColour(wx.RED)

        # Activity blinker for when we're scrolled back
        self.activity_blinker = wx.Window(self)
        self.blinker_timer = None

        # placeholder to keep stuff from being on top of the resizer thumb
        self.spacer = wx.Window(self)

        self.SetFieldsCount(6)
        #self.SetStatusStyles([wx.SB_RAISED, wx.SB_NORMAL, wx.SB_NORMAL, wx.SB_NORMAL])

        self.AddWidget(self.status_field,
                       horizontalalignment=ESB.ESB_EXACT_FIT),
        self.AddWidget(self.feature_tray,
                       horizontalalignment=ESB.ESB_ALIGN_RIGHT,
                       verticalalignment=ESB.ESB_EXACT_FIT)
        self.AddWidget(self.conn_time, horizontalalignment=ESB.ESB_EXACT_FIT)
        self.AddWidget(self.conn_status, horizontalalignment=ESB.ESB_EXACT_FIT)
        self.AddWidget(self.activity_blinker,
                       horizontalalignment=ESB.ESB_EXACT_FIT)
        self.AddWidget(self.spacer, horizontalalignment=ESB.ESB_EXACT_FIT)

        self.update_timer = wx.CallLater(1000, self.UpdateConnectionStatus)
        self.status_timer = None
        self.LayoutWidgets()
Пример #9
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        self.splitter = wx.SplitterWindow(self)

        pan1 = wx.Window(self.splitter, style=wx.BORDER_SUNKEN)
        pan1.SetBackgroundColour("yellow")
        wx.StaticText(pan1, -1, "My Left Panel")

        pan2 = wx.Window(self.splitter, style=wx.BORDER_SUNKEN)
        pan2.SetBackgroundColour("orange")
        wx.StaticText(pan2, -1, "my Right Panel")

        self.splitter.SplitVertically(pan1, pan2, -100)
Пример #10
0
 def test_splitterSplits(self):
     sw = wx.SplitterWindow(self.frame)
     sw.SplitHorizontally(wx.Window(sw), wx.Window(sw))
     sw.SetMinimumPaneSize(25)
     sw.SetSashPosition(150)
     sw.SetSashGravity(0.75)
     
     sw.MinimumPaneSize
     sw.SashGravity
     sw.SashPosition
     sw.SashSize
     sw.SplitMode
     sw.Window1
     sw.Window2
Пример #11
0
    def Split(self, px, py):
        self.m_add_child_target = None

        self.m_child[0] = _DynamicSashWindowImpl(self.m_window)
        self.m_child[0].m_container = wx.Window(self.m_container)
        self.m_child[0].m_parent = self
        self.m_child[0].m_top = self.m_top
        self.m_child[0].Create()
        if self.m_leaf.m_child:
            self.m_leaf.m_child.Reparent(self.m_container)
            self.m_child[0].AddChild(self.m_leaf.m_child)

        self.m_child[1] = _DynamicSashWindowImpl(self.m_window)
        self.m_child[1].m_container = wx.Window(self.m_container)
        self.m_child[1].m_parent = self
        self.m_child[1].m_top = self.m_top
        self.m_child[1].Create()

        self.m_split = self.m_dragging
        self.ConstrainChildren(px, py)

        self.m_top.m_add_child_target = self.m_child[1]
        split = DynamicSashSplitEvent(self.m_child[0].m_leaf.m_child)
        self.m_child[0].m_leaf._checkPendingChild()
        self.m_child[0].m_leaf.m_child.GetEventHandler().ProcessEvent(split)

        self.m_child[0].m_leaf.m_vscroll.SetScrollbar(
            self.m_leaf.m_vscroll.GetThumbPosition(),
            self.m_leaf.m_vscroll.GetThumbSize(),
            self.m_leaf.m_vscroll.GetRange(),
            self.m_leaf.m_vscroll.GetPageSize())
        self.m_child[0].m_leaf.m_hscroll.SetScrollbar(
            self.m_leaf.m_hscroll.GetThumbPosition(),
            self.m_leaf.m_hscroll.GetThumbSize(),
            self.m_leaf.m_hscroll.GetRange(),
            self.m_leaf.m_hscroll.GetPageSize())
        self.m_child[1].m_leaf.m_vscroll.SetScrollbar(
            self.m_leaf.m_vscroll.GetThumbPosition(),
            self.m_leaf.m_vscroll.GetThumbSize(),
            self.m_leaf.m_vscroll.GetRange(),
            self.m_leaf.m_vscroll.GetPageSize())
        self.m_child[1].m_leaf.m_hscroll.SetScrollbar(
            self.m_leaf.m_hscroll.GetThumbPosition(),
            self.m_leaf.m_hscroll.GetThumbSize(),
            self.m_leaf.m_hscroll.GetRange(),
            self.m_leaf.m_hscroll.GetPageSize())
        self.m_leaf.Destroy()
        self.m_leaf = None

        self.m_container.Layout()
Пример #12
0
    def create__panel(self):

        self.dpi = 100

        self.panel = wx.Panel(self)

        self.nb = wx.Notebook(self.panel)

        self.GeometryTab = wx.Window(self.nb)
        self.ForceTab = wx.Window(self.nb)
        self.DisplacementTab = wx.Window(self.nb)
        self.ModeTab = wx.Window(self.nb)

        self.nb.AddPage(self.GeometryTab, "Geometry")
        self.nb.AddPage(self.ForceTab, "Forces")
        self.nb.AddPage(self.DisplacementTab, "Displacements")
        self.nb.AddPage(self.ModeTab, "Mode Shapes")

        self.Geometry(self.nb)
        self.Forces(self.nb)
        self.Displacements(self.nb)
        self.Mode_shapes(self.nb)

        #                btn = wx.Button(self, wx.ID_OK)
        #        btn.SetDefault()

        self.buttonAccept = wx.Button(self.panel,
                                      wx.ID_OK,
                                      label="Accept Design",
                                      size=(150, -1))
        self.buttonClose = wx.Button(self.panel,
                                     wx.ID_CANCEL,
                                     label="Close",
                                     size=(150, -1))
        self.buttonAccept.SetDefault()
        self.hboxBTN = wx.BoxSizer(wx.HORIZONTAL)
        self.hboxBTN.Add(self.buttonClose)
        self.hboxBTN.Add(self.buttonAccept)

        self.vboxMP = wx.BoxSizer(wx.VERTICAL)
        self.vboxMP.AddSpacer(7)
        self.vboxMP.Add(self.hboxBTN, 0, wx.CENTER)
        self.vboxMP.Add(self.nb, 1, wx.LEFT | wx.TOP | wx.GROW)

        self.panel.SetSizer(self.vboxMP)
        self.vboxMP.Fit(self)

        self.OutputFrameSize = self.GetSize()
Пример #13
0
 def create_widget(self):
     self.widget = wx.Window(self.parent.widget,
                             self.id,
                             size=self.__size,
                             style=wx.SIMPLE_BORDER)
     self.widget.GetBestSize = self.widget.GetSize
     wx.EVT_PAINT(self.widget, self.on_paint)
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.BORDER_SIMPLE,
                 name='panel'):
        wx.Panel.__init__(self, parent, id, pos, size, style, name)
        self.SetBackgroundColour(wx.WHITE)

        hwSizer = wx.WrapSizer(wx.HORIZONTAL)

        colorList = wx.lib.colourdb.getColourInfoList()
        # For each COLOR NAME that has a space in it, the next one is a duplicate
        # without a space.
        # Lets remove the duplicates ones with spaces so they are consistant
        # with standard UPPERCASE globals.
        self.colorList = [color for color in colorList if not ' ' in color[0]]
        print('len(self.colorList) = %s' % len(self.colorList))

        self.colorMenu = self.MakeContextMenu()
        self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)

        for color in self.colorList:
            win = wx.Window(self, -1, size=(12, 12), style=wx.BORDER_SIMPLE)
            win.SetBackgroundColour(wx.Colour(color[1], color[2], color[3]))
            ttStr = '%s' % (color[0] + '\n' + '(%s, %s, %s)' %
                            (color[1], color[2], color[3]))
            win.SetToolTip(wx.ToolTip(ttStr))
            win.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
            hwSizer.Add(win, 0, wx.ALL, 2)

        self.SetSizer(hwSizer)
Пример #15
0
    def createSliceSelection(self, n, items, currentFilter, parent=None):
        """
		create a slice selection slider GUI element
		"""
        itemName = items[n]
        item = items[n]
        level = currentFilter.getParameterLevel(itemName)

        if not parent:
            parent = self
        text = currentFilter.getDesc(itemName)
        box = wx.BoxSizer(wx.VERTICAL)
        if text:
            label = wx.StaticText(self, -1, text)
            box.Add(label)
        background = wx.Window(parent, -1)

        slider = self.createSlider(currentFilter, itemName, item, background)
        if level:
            #background.SetBackgroundColour(level)
            background.SetForegroundColour(level)
            if text:
                #label.SetBackgroundColour(level)
                label.SetForegroundColour(level)

        box.Add(background, 1)
        self.itemSizer.Add(box, (self.currentRow, 0),
                           flag=wx.EXPAND | wx.HORIZONTAL)
        self.items[itemName] = box

        return 1
Пример #16
0
    def __init__(self, *args, **kwargs):
        """ Initialize a wxMainWindow.

        Parameters
        ----------
        *args, **kwargs
            The positional and keyword arguments necessary to initialize
            a wx.Frame.

        """
        super(wxMainWindow, self).__init__(*args, **kwargs)
        flags = (aui.AUI_MGR_DEFAULT | aui.AUI_MGR_LIVE_RESIZE
                 | aui.AUI_MGR_USE_NATIVE_MINIFRAMES)
        self._manager = aui.AuiManager(self, agwFlags=flags)
        self._central_widget = None
        self._tool_bars = None
        self._batch = False
        self.Bind(wx.EVT_MENU, self.OnMenu)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(aui.EVT_AUI_PANE_CLOSE, self.OnPaneClose)
        self.Bind(aui.EVT_AUI_PANE_FLOATED, self.OnPaneFloated)
        self.Bind(aui.EVT_AUI_PANE_DOCKED, self.OnPaneDocked)

        # Add a hidden dummy widget to the pane manager. This is a
        # workaround for a Wx bug where the laying out of the central
        # pane will have jitter on window resize (the computed layout
        # origin of the central pane oscillates between (0, 0) and
        # (1, 1)) if there are no other panes in the layout. If we
        # add a hidden pane with zero size, it prevents the jitter.
        self._hidden_widget = wx.Window(self)
        pane = aui.AuiPaneInfo()
        pane.BestSize(wx.Size(0, 0))
        pane.MinSize(wx.Size(0, 0))
        pane.Show(False)
        self._manager.AddPane(self._hidden_widget, pane)
Пример #17
0
    def __init__(self, parent, **traits):
        """ Creates a new widget. """

        # Base class constructors.
        super(ImageWidget, self).__init__(**traits)

        # Add some padding around the image.
        size = (self.bitmap.GetWidth() + 10, self.bitmap.GetHeight() + 10)

        # Create the toolkit-specific control.
        self.control = wx.Window(parent, -1, size=size)
        self.control.__tag__ = 'hack'

        self._mouse_over = False
        self._button_down = False

        # Set up mouse event handlers:
        wx.EVT_ENTER_WINDOW(self.control, self._on_enter_window)
        wx.EVT_LEAVE_WINDOW(self.control, self._on_leave_window)
        wx.EVT_LEFT_DCLICK(self.control, self._on_left_dclick)
        wx.EVT_LEFT_DOWN(self.control, self._on_left_down)
        wx.EVT_LEFT_UP(self.control, self._on_left_up)
        wx.EVT_PAINT(self.control, self._on_paint)

        # Pens used to draw the 'selection' marker:
        # ZZZ: Make these class instances when moved to the wx toolkit code.
        self._selectedPenDark = wx.Pen(
            wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW), 1, wx.SOLID)

        self._selectedPenLight = wx.Pen(
            wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DHIGHLIGHT), 1,
            wx.SOLID)

        return
Пример #18
0
    def createColorTransferFunctionEditor(self, n, items, currentFilter):
        """
		create a GUI element that allows the editing of a color transfer function
		"""
        itemName = items[n]
        item = items[n]
        background = wx.Window(self, -1)
        backgroundSizer = wx.BoxSizer(wx.VERTICAL)
        background.SetSizer(backgroundSizer)
        background.SetAutoLayout(1)
        level = currentFilter.getParameterLevel(itemName)

        wantAlpha = items[n][1]
        text = currentFilter.getDesc(itemName)
        if text:
            colorLbl = wx.StaticText(background, -1, text)
            backgroundSizer.Add(colorLbl)

        colorPanel = ColorTransferEditor.ColorTransferEditor(background,
                                                             alpha=wantAlpha)
        backgroundSizer.Add(colorPanel)
        self.itemSizer.Add(background, (0, 0))
        self.items[itemName] = background
        setColorTransferFunction = lambda obj, event, arg, panel = colorPanel, i = item, \
                 s = self: s.onSetCtf(panel, i, arg)

        lib.messenger.connect(currentFilter, "set_%s_ctf" % item,
                              setColorTransferFunction)
        setotf = lambda obj, event, arg, panel=colorPanel, i=item, s=self: s.onSetOtf(
            panel, i, arg)
        lib.messenger.connect(currentFilter, "set_%s_otf" % item, setotf)

        return 0
Пример #19
0
def window(dict):
    return wx.Window(id=wx.NewId(),
                     name=dict['name'],
                     parent=dict['parent'],
                     pos=dict['pos'],
                     size=dict['size'],
                     style=dict['style'])
Пример #20
0
 def create_widget(self):
     self.widget = wx.Window(self.parent_window.widget,
                             wx.ID_ANY,
                             style=wx.BORDER_SUNKEN
                             | wx.FULL_REPAINT_ON_RESIZE)
     self.widget.Bind(wx.EVT_PAINT, self.on_paint)
     self.widget.Bind(wx.EVT_ERASE_BACKGROUND, lambda event: None)
Пример #21
0
    def __init__(self, port, parent_component, wave_display, w=0.0, h=0.0, canvas=None):
        ogl.RectangleShape.__init__(self, w, h)
        self.port = port
        self.parent_component = parent_component
        self.SetCanvas(canvas)
        self.brushIndex = 0
        self.gauge = None
        self.show_timing_display = False    # Used to keep from having to refresh port display when
                                            # timing display is turned off
        self.wave_display = wave_display

        # Store the timing info; each operation function supported by the port's
        # interface has a tuple, [0,0], for both input and output timing events
        self.timingData = {}
        
        # The operations are populated when ALF is loaded and the interfaces are imported
        for op in self.port.interface.operations:
            self.timingData[op.name] = {}
            self.timingData[op.name]['begin'] = [0,0,0,0,0]   # [sec, usec, num_samples]
            self.timingData[op.name]['end'] = [0,0,0,0,0]     # [sec, usec, num_samples]
        
        self.window = wx.Window(self.GetCanvas(), id=-1, size=wx.Size(-1,-1))
        self.window.Show(False)

        self.id_tool_dict = {}
        self.wxID_PORT_INFO = wx.NewId()

        self.portMenu = wx.Menu(title='')
        self.portMenuId = wx.NewId()
        self._init_portMenu_Items(self.portMenu)
        self.port_info_shape = None
Пример #22
0
 def init(self, parent):
     """ Finishes initializing the editor by creating the underlying toolkit
         widget.
     """
     self.control = control = wx.Window(parent, -1,
                                        size=wx.Size(1, 1))
     control.SetBackgroundColour(parent.GetBackgroundColour())
Пример #23
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)]))
Пример #24
0
	def __init__(self ,parent):
		# Attributs généraux
		loc= locale.getdefaultlocale() # propriétés de l'interface wxPython
		self.int_encode= loc[1] # Encodage de l'interface
		
		# Eléments de la fenêtre principale
		wx.Frame.__init__(self, parent, -1, u'Simulement'.encode\
		(self.int_encode, 'replace'),\
		(0, 0), (-1, -1)) # Initialisation classe parente
		self.Panel= wx.Panel(self, size=(-1, -1))
		
		self.disp= wx.Window(self.Panel, pos=(-1, -1), size=(-1, -1))
		
		
		##############################
		bmp= wx.Bitmap(os.path.realpath('image/nuage-noir-avec-de-la-pluie.jpg'))
		self.img = wx.StaticBitmap(self.disp, -1)
		self.img.SetBitmap(bmp)
		self.img.SetToolTipString("Bonjour Lexileduval !")
		##############################
		
		
		# Organisation du panneau principal
		sizer_glob= wx.BoxSizer(wx.HORIZONTAL)
		sizer_glob.Add(self.disp, 1, wx.EXPAND) # Schéma
		self.Panel.SetSizer(sizer_glob)
		
		self.SetSize((600, 600))
Пример #25
0
    def __init__(self, *args, **kw):
        # ensure the parent's __init__ is called
        super(ImageViewer, self).__init__(*args, **kw)

        self.imageBox = wx.Window(self)

        self.vbox = wx.BoxSizer(wx.VERTICAL)

        # create a menu bar
        self.makeMenuBar()

        self.CreateStatusBar(5)
        self.SetStatusWidths([-1, 70, 50, 50, 30])

        self.cursor     = wx.Cursor( wx.CURSOR_ARROW)  # single arrow pointer
        self.moveCursor = wx.Cursor(wx.CURSOR_SIZING)  # N,E,S,W arrows (when panning)

        self.vbox.Add(self.imageBox,proportion=1,flag = wx.EXPAND)
        self.SetSizer(self.vbox)
        self.Show()

        self.sbm       = 0
        self.imageList = []
        self.imageIndx = 0
        self.numImages = 0
        self.factor    = 1
        self.rotation  = 0
        self.width     = 0
        self.height    = 0
        self.size      = 0
        self.count     = 0
        self.mc        = False        # change mouse cursor
        self.fs        = False        # toggle fullscreen
        self.mode      = 0            # rendering quality
        self.SetStatusText(str(self.mode), 4)
Пример #26
0
    def __init__(self, parent, singleton=True, cols=1):
        wx.Window.__init__(self, parent, wx.ID_ANY)

        self.singleton = singleton

        self.boxes = []

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.sizer)


        self.buttonwin = wx.Window(self)
        self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.buttonwin.SetSizer(self.buttonsizer)
        self.sizer.Add(self.buttonwin)

        if (not singleton):
            self.value = set()

            self.selectall = wx.Button(self.buttonwin, label="select all");
            self.selectall.Bind(wx.EVT_BUTTON, self.OnSelectAllNone)
            self.buttonsizer.Add(self.selectall)

            self.selectnone = wx.Button(self.buttonwin, label="select none");
            self.selectnone.Bind(wx.EVT_BUTTON, self.OnSelectAllNone)
            self.buttonsizer.Add(self.selectnone)

        self.scrolled = wx.ScrolledWindow(self, wx.ID_ANY)
        self.sizer.Add(self.scrolled, proportion=1, flag=wx.EXPAND|wx.ALL)

        fontsz = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize()
        self.scrolled.SetScrollRate(fontsz.x, fontsz.y)

        self.scrollsizer = wx.GridSizer(cols=cols, hgap=5, vgap=5)
        self.scrolled.SetSizer(self.scrollsizer)
Пример #27
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        # create a list of choices from the dictionary above
        choices = cursors.keys()
        choices.sort()

        # create the controls
        self.cb = wx.ComboBox(self,
                              -1,
                              "wx.CURSOR_DEFAULT",
                              choices=choices,
                              style=wx.CB_READONLY)
        self.tx = wx.StaticText(
            self, -1, "This sample allows you to see all the stock cursors \n"
            "available to wxPython.  Simply select a name from the \n"
            "wx.Choice and then move the mouse into the window \n"
            "below to see the cursor.  NOTE: not all stock cursors \n"
            "have a specific representaion on all platforms.")

        self.win = wx.Window(self, -1, size=(200, 200), style=wx.SIMPLE_BORDER)
        self.win.SetBackgroundColour("white")

        # bind an event or two
        self.Bind(wx.EVT_COMBOBOX, self.OnChooseCursor, self.cb)
        self.win.Bind(wx.EVT_LEFT_DOWN, self.OnDrawDot)

        # Setup the layout
        gbs = wx.GridBagSizer()
        gbs.Add(self.cb, (2, 1))
        gbs.Add(self.tx, (2, 3))
        gbs.Add(self.win, (5, 0), (1, 6), wx.ALIGN_CENTER)
        self.SetSizer(gbs)
    def test_lib_agw_fourwaysplitterMethods(self):
        splitter = FWS.FourWaySplitter(self.frame,
                                       -1,
                                       agwStyle=wx.SP_LIVE_UPDATE)

        panels = []
        # Put in some coloured panels...
        for colour in [wx.RED, wx.WHITE, wx.BLUE, wx.GREEN]:

            panel = wx.Panel(splitter)
            panel.SetBackgroundColour(colour)

            splitter.AppendWindow(panel)
            panels.append(panel)

        # Some methods tests...
        for index in range(4):
            self.assertEqual(splitter.GetWindow(index), panels[index])

        splitter.ExchangeWindows(panels[0], panels[3])
        self.assertEqual(splitter.GetWindow(0), panels[3])
        self.assertEqual(splitter.GetWindow(3), panels[0])

        window = wx.Window(splitter)
        splitter.ReplaceWindow(panels[3], window)
        self.assertEqual(splitter.GetWindow(0), window)

        splitter.SetExpanded(0)

        for index in range(1, 4):
            self.assertTrue(not splitter.GetWindow(index).IsShown())
Пример #29
0
    def __init__(self, parent, size=wx.DefaultSize, size_title=150, **kwargs):

        #size = wx.DefaultSize
        #size = (300,-1)
        wx.Panel.__init__(self, parent, wx.NewId(), wx.DefaultPosition, size)
        # wx.DefaultSize
        # sizer=wx.BoxSizer(wx.VERTICAL)
        sizer = wx.StaticBoxSizer(wx.StaticBox(parent, wx.NewId(), "test"),
                                  wx.VERTICAL)

        self._toolspalett = ToolPalett(self, **kwargs)

        # self._toolspalett.add_tool(BaseTool(self))

        # create initial option panel
        self._optionspanel = wx.Window(self)
        self._optionspanel.SetBackgroundColour("pink")
        wx.StaticText(self._optionspanel, -1, "Tool Options", (size_title, -1))

        # OK, but toolspane changes size with optionpanel
        #sizer.Add(self._toolspalett,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)
        # sizer.Add(self._optionspanel,1,wx.GROW)# wx.EXPAND

        sizer.Add(self._toolspalett, 0, wx.EXPAND)
        sizer.Add(self._optionspanel, 1, wx.EXPAND)

        # finish panel setup
        self.SetSizer(sizer)
        sizer.Fit(self)
Пример #30
0
 def setUp(self):
     self.frame = wx.Frame(parent=None, id=wx.ID_ANY)
     self.testControl = wx.Window(parent=self.frame, id=wx.ID_ANY)
     self.children_ids = (42, 43, 44)
     self.children_names = ('Child One', 'Child Two', 'Child Three')
     self.children = ( wx.Frame(self.testControl, id=id, name=name)
                         for id, name in zip(self.children_ids, self.children_names) )