Ejemplo n.º 1
0
    def __init__(self, *args, **kwds):
        self.collection = kwds.pop('collection')
        super(InviteFrame, self).__init__(*args, **kwds)

        icon = wx.Icon("Chandler.egg-info/resources/icons/Chandler_32.ico",
            wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)

        self.panel = wx.Panel(self, -1)

        # Main sizer, vertical box
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        self.msgCtrl = wx.TextCtrl(self.panel, -1, "",
                                   style=wx.TE_MULTILINE|wx.TE_READONLY)

        self._setURLText("")

        self.statusText = wx.StaticText(self.panel, -1, "", style=wx.TE_MULTILINE)
        self.statusText.Font = getFont(size=11.0)
        
        # Sizer to contain buttons at bottom, horizontal box
        buttonSizer = wx.StdDialogButtonSizer()

        self.CancelButton = wx.Button(self.panel, wx.ID_CANCEL)
        self.CopyButton = wx.Button(self.panel, wx.ID_OK, _(u"&Copy URL(s)"))
        self.CopyButton.SetDefault()

        buttonSizer.AddButton(self.CancelButton)
        buttonSizer.AddButton(self.CopyButton)
        buttonSizer.Realize()
        
        self.bottomSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.bottomSizer.Add(self.statusText, 1, wx.ALIGN_BOTTOM|wx.BOTTOM|wx.LEFT, 6)
        self.bottomSizer.Add(buttonSizer, 0, wx.ALIGN_BOTTOM|wx.TOP, 6)
        
        self.sizer.Add(self.bottomSizer, 0, wx.EXPAND|wx.BOTTOM, 12)
        self.sizer.MinSize = (420, 24)
        
        self.panel.SetAutoLayout(True)
        self.panel.SetSizer(self.sizer)

        self.update()

        self.panel.Layout()
        self.sizer.Fit(self)
        self.CenterOnParent()

        self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL)
        self.Bind(wx.EVT_BUTTON, self.OnCopy, id=wx.ID_OK)
Ejemplo n.º 2
0
    def __init__(self, release, download, announcement, feature=None):
        parent = getattr(wx.GetApp(), 'mainFrame', None)
        super(UpdateDialog, self).__init__(parent,
                                           -1,
                                           title=_(u"Upgrade"),
                                           size=wx.DefaultSize,
                                           pos=wx.DefaultPosition,
                                           style=wx.DEFAULT_DIALOG_STYLE)
        self.download = download
        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        logo = wx.GetApp().GetImage("Chandler_128.png")
        bitmap = wx.StaticBitmap(self, -1, logo)
        self.Sizer.Add(bitmap, 0, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 15)

        msg = _(
            u"A new version of Chandler has been released: %(version)s") % {
                'version': release
            }

        message = wx.StaticText(self, -1, msg)
        message.Font = getFont(size=15.0)
        self.Sizer.Add(message, 0, wx.GROW | wx.ALL, 15.0)

        if feature:
            featureSizer = wx.BoxSizer(wx.HORIZONTAL)
            label = wx.StaticText(self, -1, _(u"NEW FEATURE"))
            label.Font = getFont(size=10.0, weight=wx.FONTWEIGHT_BOLD)

            featureSizer.AddSpacer((15, 0))
            featureSizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.TOP,
                             1)

            featureText = wx.StaticText(self, -1, feature)
            featureText.Font = getFont(size=12.0)
            featureText.Wrap(300)
            featureSizer.Add(featureText, 0, wx.GROW | wx.LEFT | wx.ALIGN_TOP,
                             5)
            self.Sizer.Add(featureSizer, 0, wx.GROW | wx.BOTTOM, 30)

        buttonSizer = wx.StdDialogButtonSizer()
        if announcement is not None:
            hyper = wx.HyperlinkCtrl(self,
                                     -1,
                                     _(u"See what's new."),
                                     announcement.decode('UTF-8'),
                                     style=wx.ALIGN_LEFT)
            hyper.SetNormalColour("#0080ff")
            hyper.SetVisitedColour("#0080ff")
            hyper.SetHoverColour("#9999cc")
            hyper.Font = getFont(size=12.0)

            buttonSizer.Add(hyper, 0, wx.GROW | wx.ALIGN_LEFT | wx.LEFT, 15)

        default = wx.Button(self, wx.ID_OK, u"Upgrade")
        buttonSizer.AddButton(default)
        buttonSizer.AddButton(wx.Button(self, wx.ID_CANCEL, _(u"Later")))
        default.SetDefault()
        buttonSizer.Realize()

        self.Sizer.Add(buttonSizer, 0, wx.GROW | wx.BOTTOM, 12)

        self.SetAutoLayout(True)
        self.Sizer.Fit(self)

        if parent: self.CenterOnParent()
Ejemplo n.º 3
0
    def __init__(self, *args, **kw):
        kw.setdefault('style', self.DEFAULT_STYLE)
        
        self.view = kw.pop('rv', None)
        showCheckbox = kw.pop('showCheckbox', True)

        super(ShutdownDialog, self).__init__(*args, **kw)
        
        logo = wx.GetApp().GetImage("Chandler_64.png")
        bitmap = wx.StaticBitmap(self, -1, logo)

        title = wx.StaticText(self, -1, _(u"Chandler is shutting down..."))
        title.Font = getFont(size=15.0, weight=wx.FONTWEIGHT_BOLD)
        
        self.status = wx.StaticText(self, -1, " ")
        self.status.Font = getFont(size=12.0)
        
        note = wx.html.HtmlWindow(self, -1,
                             style=wx.html.HW_SCROLLBAR_NEVER|wx.html.HW_NO_SELECTION,
                             size=(270, -1))
        note.SetFonts("", "", sizes=[9, 10, 11, 12, 13, 14, 15])
        noteTxt = _(u"NOTE: ")
        warningTxt = _(u"Back up may lose data if\nChandler does not quit completely.")
        
        def fixText(text):
            return text.replace(
                        u"&", u"&"
                    ).replace(
                        u"<", u"&lt;"
                    ).replace(
                        u">", u"&gt;"
                    ).replace(
                        "\n", "<br>"
                    )

        noteHtml = ''.join((
            '<html>\n<body><b><font size="-1">',
            fixText(noteTxt),
            '</font></b>',
            fixText(warningTxt),
            '</body></html>'
        ))

        note.SetPage(noteHtml)
        ir = note.GetInternalRepresentation()
        note.SetSize((ir.GetWidth(), ir.GetHeight()))
        

        if not showCheckbox:
            checkbox = self.cancel = None
        else:
            doBackup = getattr(self._prefs, 'backupOnQuit', True)
            checkbox = wx.CheckBox(self, -1,
                                   _(u"&Back up data when quitting Chandler"))
            checkbox.Font = getFont(size=11.0)
            checkbox.Value = doBackup
            checkbox.SetFocus()
            
            self.cancel = wx.Button(self, wx.ID_CANCEL, _(u"&Skip Back up"))
            self.cancel.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            self.cancel.Enabled = doBackup
            
            checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheck)
            self.cancel.Bind(wx.EVT_BUTTON, self.OnSkipBackup)
        
        topSizer = wx.BoxSizer(wx.HORIZONTAL)
        topSizer.Add(bitmap, 0, wx.ALIGN_TOP|wx.TOP|wx.LEFT|wx.RIGHT, 20)
        
        topRightSizer = wx.BoxSizer(wx.VERTICAL)
        topRightSizer.Add(title, 0, wx.ALIGN_LEFT|wx.TOP|wx.BOTTOM|wx.RIGHT,
                          40.0)
        topRightSizer.Add(self.status, 0, wx.EXPAND, wx.TOP, 12)
        topRightSizer.Add(note, 0, wx.ALIGN_LEFT|wx.LEFT, -10)
        
        topSizer.Add(topRightSizer, 0, wx.EXPAND|wx.BOTTOM, 30)

        bottomSizer = wx.BoxSizer(wx.HORIZONTAL)
        if checkbox is not None:
            bottomSizer.Add(checkbox, 1, wx.ALIGN_BOTTOM, 0)
        if self.cancel is not None:
            bottomSizer.Add(self.cancel, 0, wx.ALIGN_BOTTOM |wx.LEFT, 40)

        self.Sizer = wx.BoxSizer(wx.VERTICAL)
        self.Sizer.Add(topSizer, 0, wx.ALIGN_LEFT|wx.ALIGN_TOP, 0)
        self.Sizer.Add(bottomSizer, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, 15)
        
        self.SetAutoLayout(True)
        self.Sizer.Fit(self)

        self.CenterOnScreen()
        self.SetBackgroundColour(wx.WHITE)
        self.status.MinSize = (self.Size.width, self.status.MinSize.height)