Python wx.DefaultSize() Examples

The following are 30 code examples of wx.DefaultSize(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: runsnake.py    From pyFileFixity with MIT License 6 votes vote down vote up
def __init__(
        self, parent=None, id=-1,
        title=_("Run Snake Run"),
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.DEFAULT_FRAME_STYLE|wx.CLIP_CHILDREN,
        name= _("RunSnakeRun"),
        config_parser=None,
    ):
        """Initialise the Frame"""
        wx.Frame.__init__(self, parent, id, title, pos, size, style, name)
        # TODO: toolbar for back, up, root, directory-view, percentage view
        self.adapter = pstatsadapter.PStatsAdapter()
        self.CreateControls(config_parser)
        self.history = [] # set of (activated_node, selected_node) pairs...
        icon = self.LoadRSRIcon()
        if icon:
            self.SetIcon( icon ) 
Example #2
Source File: PasswordCtrl.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(
        self,
        parent,
        id=-1,
        value="",
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
    ):
        if isinstance(value, eg.Password):
            self.password = value
        else:
            self.password = eg.Password(content=value)
        wx.TextCtrl.__init__(
            self,
            parent,
            id,
            self.password.Get(),
            pos,
            size,
            style=wx.TE_PASSWORD,
        ) 
Example #3
Source File: GuiAbsBase.py    From Crypter with GNU General Public License v3.0 6 votes vote down vote up
def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )

		BodySizer = wx.BoxSizer( wx.VERTICAL )

		self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		TextCtrlSizer = wx.BoxSizer( wx.VERTICAL )

		self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY )
		TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 )


		self.m_panel4.SetSizer( TextCtrlSizer )
		self.m_panel4.Layout()
		TextCtrlSizer.Fit( self.m_panel4 )
		BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 )


		self.SetSizer( BodySizer )
		self.Layout()

		self.Centre( wx.BOTH ) 
Example #4
Source File: MonitorsCtrl.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, pos, size = wx.DefaultSize):
        ID = wx.NewId()
        style = wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL
        wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
        mons = [(i[0], i[1], i[2] - i[0], i[3] - i[1]) for i in [j[2] for j in Edm()]]
        for j, header in enumerate(eg.text.General.monitorsHeader):
            self.InsertColumn(j, header, wx.LIST_FORMAT_RIGHT)
            self.SetColumnWidth(j, wx.LIST_AUTOSIZE_USEHEADER)
        for i, mon in enumerate(mons):
            self.InsertStringItem(i, str(i + 1))
            self.SetStringItem(i, 1, str(mon[0]))
            self.SetStringItem(i, 2, str(mon[1]))
            self.SetStringItem(i, 3, str(mon[2]))
            self.SetStringItem(i, 4, str(mon[3]))
        rect = self.GetItemRect(0, wx.LIST_RECT_BOUNDS)
        self.hh = rect[1]  #header height
        self.ih = rect[3]  #item height
        size = self.GetRealSize()
        self.SetMinSize(size)
        self.SetSize(size) 
Example #5
Source File: frame_downloader.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def initTotal(self, total):
        self.total = total if total > 0 else 0
        self.gauge_total = wx.Gauge(self, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize,
                                       wx.GA_HORIZONTAL)
        self.gauge_total.SetValue(0)
        self.text_percent = wx.StaticText(self, wx.ID_ANY, '0%', wx.DefaultPosition,
                                          wx.Size(42, -1), wx.ALIGN_RIGHT)
        self.text_speed = wx.StaticText(self, wx.ID_ANY, '0B/s', wx.DefaultPosition, wx.Size(65, -1),
                                        wx.ALIGN_RIGHT)

        self.text_percent.Wrap(-1)
        self.text_speed.Wrap(-1)

        self.sizer_total.Add(self.text_percent, 0, wx.ALL, 5)
        self.sizer_total.Add(self.gauge_total, 5, wx.ALL | wx.EXPAND, 5)
        self.sizer_total.Add(self.text_speed, 0, wx.ALL, 5) 
Example #6
Source File: pdfviewer(wx).py    From PyMuPDF-Utilities with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, **kwds):
        super(PDFViewer, self).__init__(parent, **kwds)

        paneCont = self.GetContentsPane()
        self.buttonpanel = pdfButtonPanel(paneCont, wx.NewId(),
                                wx.DefaultPosition, wx.DefaultSize, 0)
        self.buttonpanel.SetSizerProps(expand=True)
        self.viewer = pdfViewer(paneCont, wx.NewId(), wx.DefaultPosition,
                                wx.DefaultSize,
                                wx.HSCROLL|wx.VSCROLL|wx.SUNKEN_BORDER)

        self.viewer.SetSizerProps(expand=True, proportion=1)

        # introduce buttonpanel and viewer to each other
        self.buttonpanel.viewer = self.viewer
        self.viewer.buttonpanel = self.buttonpanel 
Example #7
Source File: xrced.py    From admin4 with Apache License 2.0 6 votes vote down vote up
def __init__(self, parent, msg, caption, pos = wx.DefaultPosition, size = (500,300)):
        from wx.lib.layoutf import Layoutf
        wx.Dialog.__init__(self, parent, -1, caption, pos, size)
        text = wx.TextCtrl(self, -1, msg, wx.DefaultPosition,
                             wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY)
        text.SetFont(g.modernFont())
        dc = wx.WindowDC(text)
        # !!! possible bug - GetTextExtent without font returns sysfont dims
        w, h = dc.GetFullTextExtent(' ', g.modernFont())[:2]
        ok = wx.Button(self, wx.ID_OK, "OK")
        text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)))
        text.SetSize((w * 80 + 30, h * 40))
        text.ShowPosition(1)
        ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)))
        self.SetAutoLayout(True)
        self.Fit()
        self.CenterOnScreen(wx.BOTH)

################################################################################

# Event handler for using during location 
Example #8
Source File: local_display.py    From Pigrow with GNU General Public License v3.0 6 votes vote down vote up
def __init__( self, parent ):
        # Settings
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Pigrow Data Display", pos = wx.DefaultPosition, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        self.Bind(wx.EVT_SIZE, self.resize_window)
        MainApp.display_panel = display_pnl(self)

        # Sizers
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        main_sizer.Add(MainApp.display_panel, 0, wx.EXPAND)
        MainApp.window_sizer = wx.BoxSizer(wx.VERTICAL)
        MainApp.window_sizer.Add(main_sizer, 0, wx.EXPAND)
        #MainApp.window_sizer.Fit(self)
        self.SetSizer(MainApp.window_sizer)
        MainApp.window_self = self
        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        self.Layout()
        self.Centre( wx.BOTH ) 
Example #9
Source File: listviews.py    From pyFileFixity with MIT License 6 votes vote down vote up
def __init__(
        self, parent,
        id=-1,
        pos=wx.DefaultPosition, size=wx.DefaultSize,
        style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL,
        validator=wx.DefaultValidator,
        columns=None,
        sortOrder=None,
        name=_("ProfileView"),
    ):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator,
                             name)

        if columns is not None:
            self.columns = columns

        if not sortOrder:
            sortOrder = [(x.defaultOrder,x) for x in self.columns if x.sortDefault]
        self.sortOrder = sortOrder or []
        self.sorted = []
        self.CreateControls() 
Example #10
Source File: dialog_copylink.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"链接浏览窗口", pos=wx.DefaultPosition, size=wx.Size(500, 500),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        sizer_global = wx.BoxSizer(wx.VERTICAL)

        self.listctrl_links = ListCtrl_CopyLink(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)
        sizer_global.Add(self.listctrl_links, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_global)
        self.Layout()

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose) 
Example #11
Source File: tree.py    From admin4 with Apache License 2.0 6 votes vote down vote up
def __init__(self, parentWin, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT):
    DragTreeCtrl.__init__(self, parentWin, "Server", size=size, style=style)
    self.groups={}
    self.nodes=[]
    self.Bind(wx.EVT_RIGHT_DOWN, self.OnTreeRightClick)
    self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeActivate)
    self.currentNode=None
    self.currentItem=None
    
    for groupName in adm.config.Read("ServerGroups", []):
      self.addGroup(groupName)
    
    for server in adm.config.getServers():
      settings=adm.config.getServerSettings(server)
      if settings:
        logger.debug("Registering %s", server)
        self.RegisterServer(settings, True)
      else:
        logger.debug("Registration for %s missing", server) 
Example #12
Source File: dialog_dllog.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"控制台日志", pos=wx.DefaultPosition, size=wx.Size(500, 500),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        sizer_global = wx.BoxSizer(wx.VERTICAL)
        self.textctrl_log = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(427, 381),
                                           wx.TE_AUTO_URL | wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        # self.listctrl_log = ListCtrl_DLLog(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)
        sizer_global.Add(self.textctrl_log, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_global)
        self.Layout()

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose) 
Example #13
Source File: CardAndReaderTreePanel.py    From pyscard with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,
                  parent,
                  ID=wx.NewId(),
                  pos=wx.DefaultPosition,
                  size=wx.DefaultSize,
                  style=0,
                  clientpanel=None):
        """Constructor. Create a smartcard tree control."""
        BaseCardTreeCtrl.__init__(self, parent, ID, pos, size,
                                   wx.TR_SINGLE | wx.TR_NO_BUTTONS,
                                   clientpanel)

        self.root = self.AddRoot("Smartcards")
        self.SetPyData(self.root, None)
        self.SetItemImage(self.root, self.fldrindex, wx.TreeItemIcon_Normal)
        self.SetItemImage(
            self.root, self.fldropenindex, wx.TreeItemIcon_Expanded)
        self.Expand(self.root) 
Example #14
Source File: core.py    From wafer_map with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, id=-1, colour=wx.BLACK,
                         pos=wx.DefaultPosition, size=wx.DefaultSize,
                         style = CLRP_DEFAULT_STYLE,
                         validator = wx.DefaultValidator,
                         name = "colourpickerwidget"):
                
                wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1), 
                                         pos, size, style, validator, name)
                self.SetColour(colour)
                self.InvalidateBestSize()
                self.SetInitialSize(size)
                self.Bind(wx.EVT_BUTTON, self.OnButtonClick)
                
                global _colourData
                if _colourData is None:
                    _colourData = wx.ColourData()
                    _colourData.SetChooseFull(True)
                    grey = 0
                    for i in range(16):
                        c = wx.Colour(grey, grey, grey)
                        _colourData.SetCustomColour(i, c)
                        grey += 16 
Example #15
Source File: pyslip.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(
        self,
        parent,
        id=wx.ID_ANY,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.NO_FULL_REPAINT_ON_RESIZE,
    ):
        """Initialize the canvas.

        parent  reference to 'parent' widget
        id      the unique widget ID
        pos     canvas position
        size    canvas size
        style   wxPython style
        """

        wx.Panel.__init__(self, parent, id, pos, size, style)

        # Bind events
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)

        # Disable background erasing (flicker-licious)
        def disable_event(*pargs, **kwargs):
            pass  # the sauce, please

        self.Bind(wx.EVT_ERASE_BACKGROUND, disable_event)

        # set callback upon onSize event
        self.onSizeCallback = None 
Example #16
Source File: wxpython_toggle.py    From R421A08-rs485-8ch-relay-board with MIT License 5 votes vote down vote up
def CreateRelayButtons(self):
        gSizer = wx.GridSizer(0, 2, 0, 0)

        # Create button 'all on'
        m_btnAllOn = wx.Button(self, 9, u'All on', wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer.Add(m_btnAllOn, 0,
                   wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)
        m_btnAllOn.Bind(wx.EVT_BUTTON, self.OnBtnAllOnClick)

        # Create button 'all off'
        m_btnAllOff = wx.Button(self, 10, u'All off', wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer.Add(m_btnAllOff, 0,
                   wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)
        m_btnAllOff.Bind(wx.EVT_BUTTON, self.OnBtnAllOffClick)

        # Create toggle buttons
        for relay in range(self.m_relay_board.num_relays):
            # Convert relay numbers to grid: First column 0..3, second column: 4..7
            if relay & 1:
                relay = 4 + int((relay - 1) / 2)
            else:
                relay = int(relay / 2)

            button_text = u'Toggle ' + str(relay + 1)
            m_btnToggleRelay = wx.Button(self, relay, button_text,
                                         wx.DefaultPosition, wx.DefaultSize, 0)
            gSizer.Add(m_btnToggleRelay, 0,
                       wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)
            m_btnToggleRelay.Bind(wx.EVT_BUTTON, self.OnBtnToggleClick)

        self.SetSizer(gSizer) 
Example #17
Source File: wxpython_toggle.py    From R421A08-rs485-8ch-relay-board with MIT License 5 votes vote down vote up
def CreateWindow(self, parent):
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetMinSize(wx.Size(250, 250))
        self.SetBackgroundColour(wx.Colour(240, 240, 240))
        if os.path.exists(ICO_PATH):
            self.SetIcon(wx.Icon(ICO_PATH))

        self.CreateMenuBar()
        self.CreateRelayButtons()
        self.CreateStatusbar()

        self.Layout()
        self.Centre(wx.BOTH) 
Example #18
Source File: EtherCATManagementEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, controler, node_editor):
        """
        Constructor
        @param parent: Reference to the parent wx.ScrolledWindow object
        @param controler: _EthercatSlaveCTN class in EthercatSlave.py
        @param node_editor: Reference to Beremiz frame
        """
        wx.Treebook.__init__(self, parent, -1, size=wx.DefaultSize, style=wx.BK_DEFAULT)
        self.parent = parent
        self.Controler = controler
        self.NodeEditor = node_editor

        self.EtherCATManagementClassObject = {}

        # fill EtherCAT Management Treebook
        panels = [
            ("Slave State",        SlaveStatePanelClass, []),
            ("SDO Management",     SDOPanelClass, []),
            ("PDO Monitoring",     PDOPanelClass, []),
            ("ESC Management",     EEPROMAccessPanel, [
                ("Smart View", SlaveSiiSmartView),
                ("Hex View", HexView)]),
            ("Register Access",     RegisterAccessPanel, [])
        ]
        for pname, pclass, subs in panels:
            self.AddPage(pclass(self, self.Controler), pname)
            for spname, spclass in subs:
                self.AddSubPage(spclass(self, self.Controler), spname)


# -------------------------------------------------------------------------------
#                    For SlaveState Panel
# ------------------------------------------------------------------------------- 
Example #19
Source File: DiscoveryPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def _init_ctrls(self, prnt):
        self.staticText1 = wx.StaticText(
            label=_('Services available:'), name='staticText1', parent=self,
            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)

        self.RefreshButton = wx.Button(
            label=_('Refresh'), name='RefreshButton', parent=self,
            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
        self.RefreshButton.Bind(wx.EVT_BUTTON, self.OnRefreshButton)

        # self.ByIPCheck = wx.CheckBox(self, label=_("Use IP instead of Service Name"))
        # self.ByIPCheck.SetValue(True)

        self._init_sizers()
        self.Fit() 
Example #20
Source File: SmartSpinNumCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(
        self,
        parent,
        id=-1,
        value=0.0,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.TE_RIGHT,
        validator=wx.DefaultValidator,
        name="eg.SmartSpinNumCtrl",
        **kwargs
    ):
        self.initValue = value
        self.value = value
        self.parent = parent
        self.kwargs = kwargs
        self.name = name
        self.nW = size[0] if size[0] != -1 else 60
        self.tW = size[0] if size[0] != -1 else 120
        if 'numWidth' in self.kwargs:
            self.nW = self.kwargs['numWidth']
            del self.kwargs['numWidth']
        if 'textWidth' in self.kwargs:
            self.tW = self.kwargs['textWidth']
            del self.kwargs['textWidth']

        wx.Window.__init__(self, parent, id, pos, size, 0)
        self.SetThemeEnabled(True)
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(self.sizer)
        self.ctrl = self.CreateCtrl(int(not isinstance(value, (int, float))))
        self.Bind(wx.EVT_SIZE, self.OnSize) 
Example #21
Source File: SerialPortChoice.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(
        self,
        parent,
        id=-1,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=0,
        validator=wx.DefaultValidator,
        name=wx.ChoiceNameStr,
        value=None
    ):
        """
        :Parameters:
            `value` : int
                The initial port to select (0 = COM1:). The first available
                port will be selected if the given port does not exist or
                no value is given.
        """
        ports = eg.SerialThread.GetAllPorts()
        self.ports = ports
        choices = [("COM%d" % (portnum + 1)) for portnum in ports]
        wx.Choice.__init__(
            self, parent, id, pos, size, choices, style, validator, name
        )
        try:
            portPos = ports.index(value)
        except ValueError:
            portPos = 0
        self.SetSelection(portPos) 
Example #22
Source File: gui_mixins.py    From wxGlade with MIT License 5 votes vote down vote up
def get_preview_obj_artprovider(self, bitmap):
        """Create a wxBitmap or wx.EmptyBitmap from the given statement using wxArtProvider.
        (note: Preview shows only wxART_* resources.)

        bitmap: Bitmap definition (str or None)

        see: Lwcodegen.BaseWidgetWriter.get_inline_stmt_artprovider()"""
        # keep in sync with BitmapMixin.get_inline_stmt_artprovider()
        art_id = 'wxART_ERROR'
        art_client = 'wxART_OTHER'
        size = wx.DefaultSize

        # art:ArtID,ArtClient
        # art:ArtID,ArtClient,width,height
        try:
            content = bitmap[4:]
            elements = [item.strip() for item in content.split(',')]
            if len(elements) == 2:
                art_id, art_client = elements
            elif len(elements) == 4:
                art_id, art_client, width, height = elements
                size = wx.Size(int(width), int(height))
            else:
                raise ValueError

        except (ValueError, TypeError):
            logging.warn( 'Malformed statement to create a bitmap via wxArtProvider(): %s', bitmap )

        # show wx art resources only
        if not art_id.startswith('wx'):     art_id     = 'wxART_HELP'
        if not art_client.startswith('wx'): art_client = 'wxART_OTHER'

        return wx.ArtProvider.GetBitmap( self.wxname2attr(self.codegen.cn(art_id)),
                                         self.wxname2attr(self.codegen.cn(art_client)), size ) 
Example #23
Source File: viewer_low_level_util.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, parent, title):
        super(grid_frame, self).__init__(parent, title=title, size=wx.DefaultSize) 
Example #24
Source File: viewer_low_level_util.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, parent, title):
        super(flex_3d_frame, self).__init__(parent, title=title, size=wx.DefaultSize)
        self.table_exist = False 
Example #25
Source File: DiscoveryPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, id, name, pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=0):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style, name=name)
        listmix.ListCtrlAutoWidthMixin.__init__(self) 
Example #26
Source File: Choice.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(
        self,
        parent,
        value,
        choices,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        *args,
        **kwargs
    ):
        wx.Choice.__init__(
            self, parent, -1, pos, size, choices, *args, **kwargs
        )
        self.SetValue(value) 
Example #27
Source File: TreeCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, document, size=wx.DefaultSize):
        self.document = document
        self.root = None
        self.editLabelId = None
        self.insertionMark = None
        self.editControl = EditControlProxy(self)
        style = (
            wx.TR_HAS_BUTTONS |
            wx.TR_EDIT_LABELS |
            wx.TR_ROW_LINES |
            wx.CLIP_CHILDREN
        )
        wx.TreeCtrl.__init__(self, parent, size=size, style=style)
        self.SetImageList(eg.Icons.gImageList)
        self.hwnd = self.GetHandle()
        self.normalfont = self.GetFont()
        self.italicfont = self.GetFont()
        self.italicfont.SetStyle(wx.FONTSTYLE_ITALIC)
        self.Bind(wx.EVT_SET_FOCUS, self.OnGetFocusEvent)
        self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusEvent)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpandingEvent)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnItemCollapsingEvent)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginLabelEditEvent)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEditEvent)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivateEvent)
        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDoubleClickEvent)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClickEvent)
        self.Bind(wx.EVT_TREE_ITEM_MENU, self.OnItemMenuEvent)
        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDragEvent)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChangedEvent)
        self.visibleNodes = {}
        self.expandedNodes = document.expandedNodes
        self.dropTarget = DropTarget(self)
        self.SetDropTarget(self.dropTarget)
        eg.Bind("NodeAdded", self.OnNodeAdded)
        eg.Bind("NodeDeleted", self.OnNodeDeleted)
        eg.Bind("NodeChanged", self.OnNodeChanged)
        eg.Bind("NodeSelected", self.OnNodeSelected)
        eg.Bind("DocumentNewRoot", self.OnNewRoot)
        if document.root:
            self.OnNewRoot(document.root) 
Example #28
Source File: item_sizer.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def initWidget(self, **kwargs):

        name = kwargs.get('name', '')
        current = kwargs.get('current', 0)
        percent = current*100.0 / self.total if self.total > 0 else 0
        speed = format_byte(kwargs.get('speed', 0), '%.1f%s/S')

        self.text_name = wx.StaticText(self.parent, wx.ID_ANY, name, wx.DefaultPosition, wx.Size(20, -1),
                                       wx.ALIGN_RIGHT)
        self.text_percent = wx.StaticText(self.parent, wx.ID_ANY, str(round(percent, 1)) + '%', wx.DefaultPosition,
                                          wx.Size(40, -1), wx.ALIGN_RIGHT)
        self.text_speed = wx.StaticText(self.parent, wx.ID_ANY, speed, wx.DefaultPosition, wx.Size(65, -1),
                                        wx.ALIGN_RIGHT)

        self.text_name.Wrap(-1)
        self.text_percent.Wrap(-1)
        self.text_speed.Wrap(-1)

        self.gauge_progress = wx.Gauge(self.parent, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize,
                                       wx.GA_HORIZONTAL)
        self.gauge_progress.SetValue(int(percent*100))

        self.Add(self.text_name, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.Add(self.gauge_progress, 5, wx.ALL, 5)
        self.Add(self.text_percent, 0, wx.ALL, 5)
        self.Add(self.text_speed, 0, wx.ALL, 5)
        # self.Add(self.text_progress, 0, wx.ALL, 5)
        staticline1 = wx.StaticLine(self.parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)

        self.Add(staticline1, 0, wx.EXPAND | wx.ALL, 2) 
Example #29
Source File: dialog_gettool.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def __init__(self, parent, title, total_byte, dlm):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=title, pos=wx.DefaultPosition, size=wx.DefaultSize,
                           style=wx.DEFAULT_DIALOG_STYLE)
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

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

        self.gauge_progress = wx.Gauge(self, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL)
        self.gauge_progress.SetValue(524)
        self.global_sizer.Add(self.gauge_progress, 0, wx.ALL | wx.EXPAND, 5)

        sizer_info = wx.BoxSizer(wx.HORIZONTAL)

        self.text_percent = wx.StaticText(self, wx.ID_ANY, u"0.0%", wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_LEFT)
        self.text_percent.Wrap(-1)

        sizer_info.Add(self.text_percent, 1, wx.ALL, 5)

        self.total_byte = total_byte
        self.format_int = '%0' + str(len(str(self.total_byte))) + 'd/%0' + str(len(str(self.total_byte))) + 'd'

        self.text_progress = wx.StaticText(self, wx.ID_ANY, self.format_int % (0, self.total_byte), wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_RIGHT)
        self.text_progress.Wrap(-1)

        sizer_info.Add(self.text_progress, 1, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.global_sizer.Add(sizer_info, 1, wx.EXPAND, 5)

        self.SetSizer(self.global_sizer)
        self.Layout()
        self.global_sizer.Fit(self)

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.timer = wx.Timer()

        self.timer.SetOwner(self, wx.ID_ANY)
        self.dlm = dlm 
Example #30
Source File: dialogs.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, dlg_title, box_label, choices, options=None, defaults=None):
        """Initialise the dialog and draw the content

        dlg_title: Dialog title
        box_label: Label of the draw around the listed choices
        choices: Choices to select one (string list)"""
        pos = wx.GetMousePosition()
        wx.Dialog.__init__(self, None, -1, dlg_title, pos)

        szr = wx.BoxSizer(wx.VERTICAL)

        self.box = wx.RadioBox( self, wx.ID_ANY, box_label, wx.DefaultPosition, wx.DefaultSize,choices.split('|'),
                                1, style=wx.RA_SPECIFY_COLS )
        self.box.SetSelection(0)
        szr.Add(self.box, 5, wx.ALL | wx.EXPAND, 10)

        if options:
            self.options = []
            for o, option in enumerate(options):
                cb = wx.CheckBox(self, -1, option)
                cb.SetValue(defaults and defaults[o])
                szr.Add(cb, 0, wx.ALL, 10)
                self.options.append(cb)

        # buttons
        btnbox = wx.StdDialogButtonSizer()
        btnOK = wx.Button(self, wx.ID_OK)
        btnOK.SetDefault()
        btnCANCEL = wx.Button(self, wx.ID_CANCEL)
        btnbox.AddButton(btnOK)
        btnbox.AddButton(btnCANCEL)
        btnbox.Realize()
        szr.Add(btnbox, 0, wx.ALL|wx.ALIGN_CENTER, 5)

        self.SetAutoLayout(True)
        self.SetSizer(szr)
        szr.Fit(self)