Exemplo n.º 1
0
    def layout(self):
        'Initial sizer layout.'

        self.Sizer = sz = wx.BoxSizer(wx.VERTICAL)

        # The flex grid sizer is where controls are subbed in and out depending
        # on the action.
        self.flex = f = wx.FlexGridSizer(-1, 2, 6, 6)

        # define some shortcuts for adding controls to the flex grid for
        # consistent spacing

        AddFlexControl = lambda c: self.flex.Add(c, 0, wx.EXPAND | wx.ALL, 5)

        def AddHeader(header):
            AddFlexControl(wx.StaticText(self, -1, _(header)))

        def AddControl(name, ctrl, data_extractor = 'Value'):
            self.action_ctrls[name] = (ctrl, data_extractor)
            AddFlexControl(ctrl)

        self.flex.AddHeader  = AddHeader
        self.flex.AddControl = AddControl

        self.on_action_choice()

        sz.Add(self.event_header, 0, wx.EXPAND | wx.ALL, 10)
        sz.Add(f, 1, wx.EXPAND)

        # OK/Cancel
        sz.Add(build_button_sizer(save=self.ok, cancel=self.cancel),
               0, wx.EXPAND | wx.SOUTH | wx.EAST | wx.WEST, 4)
Exemplo n.º 2
0
    def layout(self):
        'Initial sizer layout.'

        self.Sizer = sz = wx.BoxSizer(wx.VERTICAL)

        # The flex grid sizer is where controls are subbed in and out depending
        # on the action.
        self.flex = f = wx.FlexGridSizer(-1, 2, 6, 6)

        # define some shortcuts for adding controls to the flex grid for
        # consistent spacing

        AddFlexControl = lambda c: self.flex.Add(c, 0, wx.EXPAND | wx.ALL, 5)

        def AddHeader(header):
            AddFlexControl(wx.StaticText(self, -1, _(header)))

        def AddControl(name, ctrl, data_extractor='Value'):
            self.action_ctrls[name] = (ctrl, data_extractor)
            AddFlexControl(ctrl)

        self.flex.AddHeader = AddHeader
        self.flex.AddControl = AddControl

        self.on_action_choice()

        sz.Add(self.event_header, 0, wx.EXPAND | wx.ALL, 10)
        sz.Add(f, 1, wx.EXPAND)

        # OK/Cancel
        sz.Add(build_button_sizer(save=self.ok, cancel=self.cancel), 0,
               wx.EXPAND | wx.SOUTH | wx.EAST | wx.WEST, 4)
Exemplo n.º 3
0
    def __init__(self, parent, contact):

        from contacts import MetaContact
        name = contact.alias if isinstance(contact, MetaContact) else contact.name

        wx.Dialog.__init__(self, parent, title = _('Editing Alerts for {name}').format(name=name))
        self.Sizer = s = wx.BoxSizer(wx.VERTICAL)

        self.contact = contact

        add_button = wx.Button(self, -1, '+')
        add_button.Size = (15, 15)
        remove_button = wx.Button(self, -1, '-')
        remove_button.Size = (15, 15)
        h = wx.BoxSizer(wx.HORIZONTAL)
        h.AddStretchSpacer(1)
        h.Add(add_button)
        h.Add(remove_button)
        s.Add(h, 0, wx.EXPAND | wx.ALL, 3)

        self.notview = NotificationView(self, deepcopy(dict(get_notifications())), contact,
                                        (add_button, remove_button))

        s.Add(self.notview, 1, wx.EXPAND)

        # Save and cancel buttons
        save = wx.Button(self, wx.ID_SAVE, _('&Save'))
        cancel = wx.Button(self, wx.ID_CANCEL, _('&Cancel'))
        button_sizer = build_button_sizer(save, cancel)

        save.Bind(wx.EVT_BUTTON, lambda e: self.EndModal(wx.ID_SAVE))

        s.Add(button_sizer, 0, wx.EXPAND | wx.ALL, 7)
Exemplo n.º 4
0
    def layout_bottom(self, sizer, row):
        s = self.Sizer

        sizer.Add(self.expand, (row, 0), (1, 3))
        row += 1

        self.details = Clique()

        account_gui = getattr(self.protocolinfo, "account_gui", None)
        if account_gui is not None:
            # Protocolmeta can specify a lazy import path to separate
            # GUI components.
            with traceguard:
                self.add_account_gui(account_gui)
        else:
            getattr(self, "build_details_" + self.formtype, getattr(self, "build_details_default"))(sizer, row)

        self.expand.Show(bool(self.details))

        self.details.Show(False)
        s.Add(
            build_button_sizer(self.save, self.cancel, border=self.save.GetDefaultBorder()),
            0,
            EXPAND | ALL,
            self.GetDefaultBorder(),
        )
Exemplo n.º 5
0
    def init_components(self):
        self.old_pw_label = wx.StaticText(self, label=_("Old Password: "******"New Password: "******"Confirm New Password: "))
        self.new2_pw_text = wx.TextCtrl(self,
                                        style=wx.TE_PASSWORD,
                                        validator=LengthLimit(1024))

        self.ok_btn = wx.Button(self, wx.ID_OK)
        self.ok_btn.Enable(False)
        self.ok_btn.SetDefault()
        self.cancel_btn = wx.Button(self, wx.ID_CANCEL)

        self.old_sizer = BoxSizer(HORIZONTAL)
        self.new1_sizer = BoxSizer(HORIZONTAL)
        self.new2_sizer = BoxSizer(HORIZONTAL)

        self.btn_sizer = build_button_sizer(self.ok_btn, self.cancel_btn, 2)

        self.main_sizer = BoxSizer(VERTICAL)

        self.Sizer = BoxSizer(HORIZONTAL)
Exemplo n.º 6
0
    def layout(self):
        if self.basic_panel is not None:
            self.Sizer = wx.BoxSizer(wx.VERTICAL)
            self.Sizer.Add(self.basic_panel)

        if self.advanced_panel:
            self.Sizer.Add(self.chevron, 1, wx.EXPAND | wx.LEFT, 3)
            self.chevron.contents.Sizer.Add(self.advanced_panel, 1, wx.EXPAND)

        self.Sizer.Add(toolbox.build_button_sizer(self.save_btn, self.cancel_btn, border = self.save_btn.GetDefaultBorder()), 0, wx.EXPAND | wx.ALL, self.GetDefaultBorder())

        self.hook('digsby.services.edit.layout.polish', self.basic_panel, getattr(self, 'advanced_panel', None))
Exemplo n.º 7
0
    def layout_gui(self):
        self.content_sizer = wx.BoxSizer(wx.VERTICAL)

        hz = wx.BoxSizer(wx.HORIZONTAL)
        hz.Add(self.build_tab_sizer(), 0, EXPAND_ALL)
        hz.Add(self.content_sizer, 1, EXPAND_ALL)

        v  = wx.BoxSizer(wx.VERTICAL)
        v.Add(hz, 1, EXPAND_ALL)

        if getattr(self, 'save_button', False):
            v.Add(build_button_sizer(self.save_button, border = self.border),
                  0, wx.EXPAND | wx.SOUTH | wx.EAST, 4)
        self.Sizer = v
Exemplo n.º 8
0
    def layout_gui(self):
        self.content_sizer = wx.BoxSizer(wx.VERTICAL)

        hz = wx.BoxSizer(wx.HORIZONTAL)
        hz.Add(self.build_tab_sizer(), 0, EXPAND_ALL)
        hz.Add(self.content_sizer, 1, EXPAND_ALL)

        v = wx.BoxSizer(wx.VERTICAL)
        v.Add(hz, 1, EXPAND_ALL)

        if getattr(self, 'save_button', False):
            v.Add(build_button_sizer(self.save_button, border=self.border), 0,
                  wx.EXPAND | wx.SOUTH | wx.EAST, 4)
        self.Sizer = v
Exemplo n.º 9
0
    def layout(self):
        self.Sizer = sz = wx.BoxSizer(wx.VERTICAL)

        sz.Add(self.name_st, 0, wx.EXPAND | wx.ALL, 5)
        sz.Add(self.name_txt, 0, wx.EXPAND | wx.ALL, 5)

        sz.Add((0,5))

        sz.Add(self.acct_st, 0, wx.EXPAND | wx.ALL, 5)
        sz.Add(self.acct_choice, 0, wx.EXPAND | wx.ALL, 5)

        # Add/Cancel
        sz.Add(build_button_sizer(save=self.save, cancel=self.cancel),
               0, wx.EXPAND | wx.SOUTH | wx.EAST | wx.WEST, 4)
Exemplo n.º 10
0
    def layout(self):
        self.Sizer = sz = wx.BoxSizer(VERTICAL)

        h1 = wx.BoxSizer(VERTICAL)
        h1.Add(self.line1,0,ALIGN_CENTER_HORIZONTAL)
        h1.Add(self.line2,0,ALIGN_CENTER_HORIZONTAL|TOP,3)
        h1.Add(self.sep,0,EXPAND|TOP,6)
        h1.Add(self.alias_label,0,TOP,6)
        h1.Add(self.alias_text,0,EXPAND|TOP,3)

        h1.Add(self.line4,0,TOP,6)
        h1.Add(self.contacts_list,1, EXPAND|TOP,3)

        sz.Add(h1, 1, EXPAND|ALL,6)
        # Save/Cancel
        sz.Add(build_button_sizer(save=self.save, cancel=self.cancel),
               0, EXPAND | TOPLESS, 4)
Exemplo n.º 11
0
    def layout(self):
        if self.basic_panel is not None:
            self.Sizer = wx.BoxSizer(wx.VERTICAL)
            self.Sizer.Add(self.basic_panel)

        if self.advanced_panel:
            self.Sizer.Add(self.chevron, 1, wx.EXPAND | wx.LEFT, 3)
            self.chevron.contents.Sizer.Add(self.advanced_panel, 1, wx.EXPAND)

        self.Sizer.Add(
            toolbox.build_button_sizer(
                self.save_btn,
                self.cancel_btn,
                border=self.save_btn.GetDefaultBorder()), 0,
            wx.EXPAND | wx.ALL, self.GetDefaultBorder())

        self.hook('digsby.services.edit.layout.polish', self.basic_panel,
                  getattr(self, 'advanced_panel', None))
Exemplo n.º 12
0
    def layout_bottom(self, sizer, row):
        s = self.Sizer

        sizer.Add(self.expand, (row, 0), (1,3))
        row+=1

        self.details = Clique()

        account_gui = getattr(self.protocolinfo, 'account_gui', None)
        if account_gui is not None:
            # Protocolmeta can specify a lazy import path to separate
            # GUI components.
            with traceguard:
                self.add_account_gui(account_gui)
        else:
            getattr(self, 'build_details_' + self.formtype,
                    getattr(self, 'build_details_default'))(sizer,row)

        self.expand.Show(bool(self.details))

        self.details.Show(False)
        s.Add(build_button_sizer(self.save, self.cancel, border=self.save.GetDefaultBorder()), 0, EXPAND | ALL, self.GetDefaultBorder())
Exemplo n.º 13
0
    def init_components(self):
        self.old_pw_label  = wx.StaticText(self, label = _("Old Password: "******"New Password: "******"Confirm New Password: "))
        self.new2_pw_text  = wx.TextCtrl(self, style=wx.TE_PASSWORD, validator=LengthLimit(1024))

        self.ok_btn = wx.Button(self, wx.ID_OK)
        self.ok_btn.Enable(False)
        self.ok_btn.SetDefault()
        self.cancel_btn = wx.Button(self, wx.ID_CANCEL)

        self.old_sizer  = BoxSizer(HORIZONTAL)
        self.new1_sizer = BoxSizer(HORIZONTAL)
        self.new2_sizer = BoxSizer(HORIZONTAL)

        self.btn_sizer  = build_button_sizer(self.ok_btn, self.cancel_btn, 2)

        self.main_sizer = BoxSizer(VERTICAL)

        self.Sizer      = BoxSizer(HORIZONTAL)
Exemplo n.º 14
0
    def __init__(self, parent, contact):

        from contacts import MetaContact
        name = contact.alias if isinstance(contact,
                                           MetaContact) else contact.name

        wx.Dialog.__init__(
            self,
            parent,
            title=_('Editing Alerts for {name}').format(name=name))
        self.Sizer = s = wx.BoxSizer(wx.VERTICAL)

        self.contact = contact

        add_button = wx.Button(self, -1, '+')
        add_button.Size = (15, 15)
        remove_button = wx.Button(self, -1, '-')
        remove_button.Size = (15, 15)
        h = wx.BoxSizer(wx.HORIZONTAL)
        h.AddStretchSpacer(1)
        h.Add(add_button)
        h.Add(remove_button)
        s.Add(h, 0, wx.EXPAND | wx.ALL, 3)

        self.notview = NotificationView(self,
                                        deepcopy(dict(get_notifications())),
                                        contact, (add_button, remove_button))

        s.Add(self.notview, 1, wx.EXPAND)

        # Save and cancel buttons
        save = wx.Button(self, wx.ID_SAVE, _('&Save'))
        cancel = wx.Button(self, wx.ID_CANCEL, _('&Cancel'))
        button_sizer = build_button_sizer(save, cancel)

        save.Bind(wx.EVT_BUTTON, lambda e: self.EndModal(wx.ID_SAVE))

        s.Add(button_sizer, 0, wx.EXPAND | wx.ALL, 7)
Exemplo n.º 15
0
    def layout(self, is_exception):
        self.Sizer = sz = BoxSizer(wx.VERTICAL)

        # The upper two fields: title text field and state combo box
        inner = wx.FlexGridSizer(2, 2, 6, 6)

        if not is_exception:
            inner.AddMany([ (self.title_label, 0, wx.ALIGN_CENTER_VERTICAL),
                            (self.title) ])
        inner.AddMany([ (self.status_label, 0, wx.ALIGN_CENTER_VERTICAL),
                        (self.status) ])
        inner.AddGrowableCol(1, 1)
        sz.Add(inner, 0, wx.EXPAND | wx.ALL, 8)

        # The label for the message, and the big text area itself
        sz.Add(self.message_label, 0, EXPAND | ALL,            8)
        h = wx.BoxSizer(wx.HORIZONTAL)
        h.Add((1,status_message_size[1]))
        h.Add(self.message_panel,       1, EXPAND)
        sz.Add(h, 1, EXPAND | RIGHT | LEFT, 15)
        #sz.Add(self.message)

        sz.AddSpacer(3)

        # Save For Later
        if self.save_checkbox: sz.Add(self.save_check, 0, EXPAND | TOP | LEFT, 8)

        if not is_exception:
            # The checkbox to expand the dialog
            sz.Add(self.diffcheck,  0, EXPAND | ALL, 8)

            # Status exceptions
            sz.Add(self.exceptionspanel, 0, EXPAND | RIGHT | LEFT | BOTTOM, 8)

        # Save/Cancel
        sz.Add(build_button_sizer(save=self.save, cancel=self.cancel), 0, EXPAND | BOTTOM | RIGHT | LEFT, 4)