Пример #1
0
    def __init__(self, latest, runningVersion):
        wx.Dialog.__init__(self, None, -1, title='PsychoPy2 auto-updater')
        sizer = wx.BoxSizer(wx.VERTICAL)

        #info about current version
        msg1 = wx.StaticText(
            self,
            -1,
            style=wx.ALIGN_CENTRE,
            label="PsychoPy v%s is available (you are running %s)." %
            (latest['version'], runningVersion))
        if latest['lastCompatible'] > runningVersion:
            msg2 = wx.StaticText(
                self,
                -1,
                style=wx.ALIGN_CENTRE,
                label=
                "This version MAY require you to modify your\nscripts/exps slightly. Read the changelog carefully."
            )
            msg2.SetForegroundColour([200, 0, 0])
        else:
            msg2 = wx.StaticText(
                self,
                -1,
                style=wx.ALIGN_CENTRE,
                label=
                "There are no known compatibility\nissues with your current version."
            )
        changelogLink = wxhl.HyperLinkCtrl(
            self,
            wx.ID_ANY,
            "View complete Changelog",
            URL="http://www.psychopy.org/changelog.html")

        msg3 = wx.StaticText(self, -1, "Should PsychoPy update itself?")
        sizer.Add(msg1, flag=wx.ALL | wx.CENTER, border=15)
        sizer.Add(msg2, flag=wx.RIGHT | wx.LEFT | wx.CENTER, border=15)
        sizer.Add(changelogLink, flag=wx.RIGHT | wx.LEFT | wx.CENTER, border=5)
        sizer.Add(msg3, flag=wx.ALL | wx.CENTER, border=15)

        #add buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.yesBtn = wx.Button(self, wx.ID_YES, 'Yes')
        self.cancelBtn = wx.Button(self, wx.ID_CANCEL, 'Not now')
        self.noBtn = wx.Button(self, wx.ID_NO, 'Skip this version')
        self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_CANCEL)
        self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_YES)
        self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_NO)
        self.yesBtn.SetDefault()
        btnSizer.Add(self.noBtn, wx.ALIGN_LEFT)
        btnSizer.Add((60, 20), 0, wx.EXPAND)
        btnSizer.Add(self.cancelBtn, wx.ALIGN_RIGHT)
        btnSizer.Add((5, 20), 0)
        btnSizer.Add(self.yesBtn, wx.ALIGN_RIGHT)

        #configure sizers and fit
        sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
        self.Center()
        self.SetSizerAndFit(sizer)
Пример #2
0
    def get_path_box(self, font):

        vbox_path = wx.BoxSizer(wx.VERTICAL)

        st_local = wx.StaticText(self, label='Local Path')
        st_local.SetFont(font)
        st_local.SetForegroundColour('sea green')
        vbox_path.Add(st_local, flag=wx.LEFT | wx.RIGHT, border=10)

        self.local_hyperlink = hl.HyperLinkCtrl(self,
                                                wx.ID_ANY,
                                                get_file_path(True),
                                                URL="")
        self.local_hyperlink.SetFont(font)
        self.local_hyperlink.SetColours("BLUE", "BLUE", "BLUE")
        self.local_hyperlink.EnableRollover(True)
        self.local_hyperlink.Bind(hl.EVT_HYPERLINK_LEFT, self.onLocalHyperLink)
        self.local_hyperlink.SetToolTip(wx.ToolTip("Click to view file"))
        self.local_hyperlink.AutoBrowse(False)
        self.local_hyperlink.UpdateLink()
        vbox_path.Add(self.local_hyperlink, flag=wx.LEFT | wx.RIGHT, border=10)

        vbox_path.Add((-1, 10))

        st_global = wx.StaticText(self, label='Global Path')
        st_global.SetFont(font)
        st_global.SetForegroundColour('sea green')
        vbox_path.Add(st_global, flag=wx.LEFT | wx.RIGHT, border=10)

        self.global_hyperlink = hl.HyperLinkCtrl(self,
                                                 wx.ID_ANY,
                                                 get_file_path(False),
                                                 URL="")
        self.global_hyperlink.SetFont(font)
        self.global_hyperlink.SetColours("GOLD", "GOLD", "GOLD")
        self.global_hyperlink.EnableRollover(True)
        self.global_hyperlink.Bind(hl.EVT_HYPERLINK_LEFT,
                                   self.onGlobalHyperLink)
        self.global_hyperlink.SetToolTip(wx.ToolTip("Click to view file"))
        self.global_hyperlink.AutoBrowse(False)
        self.global_hyperlink.UpdateLink()
        vbox_path.Add(self.global_hyperlink,
                      flag=wx.LEFT | wx.RIGHT,
                      border=10)

        return vbox_path
Пример #3
0
    def __init__(self,latest,runningVersion):
        wx.Dialog.__init__(self,None,-1,title='PsychoPy2 Updates')
        sizer=wx.BoxSizer(wx.VERTICAL)

        #info about current version
        msg1 = wx.StaticText(self,-1,style=wx.ALIGN_CENTRE,
            label=_translate("PsychoPy v%(latest)s is available (you are running %(running)s).\n\n(To disable this check, see Preferences > connections > checkForUpdates)") % {'latest':latest['version'],'running':runningVersion})
        if latest['lastCompatible']>runningVersion:
            msg2 = wx.StaticText(self,-1,style=wx.ALIGN_CENTRE,
            label=_translate("This version MAY require you to modify your\nscripts/exps slightly. Read the changelog carefully."))
            msg2.SetForegroundColour([200,0,0])
        else: msg2 = wx.StaticText(self,-1,style=wx.ALIGN_CENTRE,
            label=_translate("There are no known compatibility\nissues with your current version."))
        changelogLink = wxhl.HyperLinkCtrl(self, wx.ID_ANY, _translate("View complete Changelog"),
                                        URL="http://www.psychopy.org/changelog.html")

        if sys.platform.startswith('linux'):
            msg3 = wx.StaticText(self,-1,_translate("You can update PsychoPy with your package manager"))
        else:
            msg3 = wx.StaticText(self,-1,_translate("Should PsychoPy update itself?"))

        sizer.Add(msg1,flag=wx.ALL|wx.CENTER,border=15)
        sizer.Add(msg2,flag=wx.RIGHT|wx.LEFT|wx.CENTER,border=15)
        sizer.Add(changelogLink,flag=wx.RIGHT|wx.LEFT|wx.CENTER,border=5)
        sizer.Add(msg3,flag=wx.ALL|wx.CENTER,border=15)

        #add buttons
        btnSizer=wx.BoxSizer(wx.HORIZONTAL)

        if sys.platform.startswith('linux'):#for linux there should be no 'update' option
            self.cancelBtn=wx.Button(self,wx.ID_CANCEL,_translate('Keep warning me'))
            self.cancelBtn.SetDefault()
            self.noBtn=wx.Button(self,wx.ID_NO,_translate('Stop warning me'))
        else:
            self.yesBtn=wx.Button(self,wx.ID_YES,_translate('Yes'))
            self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_YES)
            self.cancelBtn=wx.Button(self,wx.ID_CANCEL,_translate('Not now'))
            self.noBtn=wx.Button(self,wx.ID_NO,_translate('Skip this version'))
        self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_CANCEL)
        self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_NO)
        btnSizer.Add(self.noBtn, wx.ALIGN_LEFT)
        btnSizer.Add((60, 20), 0, wx.EXPAND)
        btnSizer.Add(self.cancelBtn, wx.ALIGN_RIGHT)

        if not sys.platform.startswith('linux'):
            self.yesBtn.SetDefault()
            btnSizer.Add((5, 20), 0)
            btnSizer.Add(self.yesBtn, wx.ALIGN_RIGHT)

        #configure sizers and fit
        sizer.Add(btnSizer,flag=wx.ALIGN_RIGHT|wx.ALL,border=5)
        self.Center()
        self.SetSizerAndFit(sizer)
Пример #4
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)
        self.SetFont(wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False))

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

        # Creator credits
        text1 = wx.StaticText(self, -1, "HyperLinkCtrl Example By Andrea Gavana")
        text1.SetFont(wx.Font(9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, 'Verdana'))

        sizer.Add((0,10))
        sizer.Add(text1, 0, wx.LEFT | wx.TOP | wx.BOTTOM, 10)

        text2 = wx.StaticText(self, -1, "Latest Revision: 11 May 2005")
        text2.SetFont(wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, 'Verdana'))
        sizer.Add(text2, 0, wx.LEFT, 10)

        sizer.Add((0,25))

        # Default Web links:
        self._hyper1 = hl.HyperLinkCtrl(self, wx.ID_ANY, "wxPython Main Page",
                                        URL="http://www.wxpython.org/")
        sizer.Add(self._hyper1, 0, wx.ALL, 10)


        # Web link with underline rollovers, opens in window
        self._hyper2 = hl.HyperLinkCtrl(self, wx.ID_ANY, "My Home Page",
                                        URL="http://xoomer.virgilio.it/infinity77/")
        sizer.Add(self._hyper2, 0, wx.ALL, 10)
        self._hyper2.Bind(hl.EVT_HYPERLINK_MIDDLE, self.OnMiddleLink)
        self._hyper2.AutoBrowse(False)
        self._hyper2.SetColours("BLUE", "BLUE", "BLUE")
        self._hyper2.EnableRollover(True)
        self._hyper2.SetUnderlines(False, False, True)
        self._hyper2.SetBold(True)
        self._hyper2.OpenInSameWindow(True) # middle click to open in window
        self._hyper2.SetToolTip(wx.ToolTip("Middle-click to open in browser window"))
        self._hyper2.UpdateLink()


        # Intense link examples..
        self._hyper3 = hl.HyperLinkCtrl(self, wx.ID_ANY, "wxPython Mail Archive",
                                        URL="http://lists.wxwidgets.org/")
        sizer.Add(self._hyper3, 0, wx.ALL, 10)
        self._hyper3.Bind(hl.EVT_HYPERLINK_RIGHT, self.OnRightLink)

        self._hyper3.SetLinkCursor(wx.CURSOR_QUESTION_ARROW)
        self._hyper3.SetColours("DARK GREEN", "RED", "NAVY")
        self._hyper3.SetUnderlines(False, False, False)
        self._hyper3.EnableRollover(True)
        self._hyper3.SetBold(True)
        self._hyper3.DoPopup(False)
        self._hyper3.UpdateLink()


        self._hyper4 = hl.HyperLinkCtrl(self, wx.ID_ANY,
                                        "Open Google In Current Browser Window?",
                                        URL="http://www.google.com")
        sizer.Add(self._hyper4, 0, wx.ALL, 10)
        self._hyper4.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLink)
        self._hyper4.SetToolTip(wx.ToolTip("Click link for yes, no, cancel dialog"))
        self._hyper4.AutoBrowse(False)
Пример #5
0
    def __init__(
        self,
        parent,
        ID,
        title,
        size=wx.DefaultSize,
        pos=wx.DefaultPosition,
        style=wx.DEFAULT_DIALOG_STYLE,
    ):
        pre = wx.PreDialog()
        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        pre.Create(parent, ID, title, pos, size, style)

        self.PostCreate(pre)
        wrap = 360
        linkPosX = 0
        copyRightPosX = 0
        if wx.Platform == '__WXMSW__':
            wrap = 260
            linkPosX = 30
            copyRightPosX = -30

        whitePanel = wx.Panel(self, -1, size=(499, 440), pos=(0, 0))
        whitePanel.SetBackgroundColour("White")

        logoImage = images.geticon_128x128Bitmap()
        logo = wx.StaticBitmap(whitePanel,
                               -1,
                               logoImage,
                               size=(128, 128),
                               pos=(136, 20))

        versionLabel = wx.StaticText(whitePanel,
                                     -1,
                                     "Version 1.1.0",
                                     pos=(156, 150))

        descLabel = wx.StaticText(
            whitePanel,
            -1,
            "From day one, our goal was to give physical form to Wikipedia, one of the most interesting aspects of the Internet, so people can bring it with them everywhere they go. We want to promote personal growth and the ability to enjoy those unexpected moments when curiosity strikes. WikiReader is our gift for those who have the openness to experience life and the willingness to be changed by it.",
            pos=(20, 180))
        descLabel.Wrap(wrap)
        descLabelFont = wx.Font(defaultFontSize,
                                wx.DEFAULT,
                                wx.NORMAL,
                                wx.NORMAL,
                                underline=False,
                                faceName="Helvetica",
                                encoding=wx.FONTENCODING_DEFAULT)
        descLabel.SetFont(descLabelFont)

        hl.HyperLinkCtrl(whitePanel,
                         wx.ID_ANY,
                         "WikiReader uses only open source software",
                         URL="https://github.com/wikireader",
                         pos=(70 + linkPosX, 340))

        copyrightLabel = wx.StaticText(
            whitePanel,
            -1,
            u"Copyright \N{Copyright Sign} 2012 Openmoko Inc. All rights reserved. The \nWikipedia name and logo are registered trademarks owned by \nthe Wikimedia Foundation and used with permission.",
            size=(499, 40),
            pos=(50 + copyRightPosX, 370),
            style=wx.ALIGN_CENTER)
        copyrightLabelFont = wx.Font(defaultSmallSize,
                                     wx.DEFAULT,
                                     wx.NORMAL,
                                     wx.NORMAL,
                                     underline=False,
                                     faceName="Helvetica",
                                     encoding=wx.FONTENCODING_DEFAULT)
        copyrightLabel.SetFont(copyrightLabelFont)
Пример #6
0
 def OnTwitter(self, evt):
     h = hl.HyperLinkCtrl(self, wx.ID_ANY)
     h.GotoURL("http://twitter.com/wikireader", True, True)
Пример #7
0
 def OnFAQ(self, evt):
     h = hl.HyperLinkCtrl(self, wx.ID_ANY)
     h.GotoURL("http://thewikireader.com/#faq", True, True)
Пример #8
0
    def __init__(self, parent, x=100, y=100):

        wx.Dialog.__init__(self,
                           None,
                           title="About",
                           pos=(x, y),
                           size=(400, 350))

        bmp = emb.GetBitmap_wafermap_png()
        img = wx.StaticBitmap(self, -1, bmp, (20, 20),
                              (bmp.GetWidth(), bmp.GetHeight()))

        str = "This is a different font."
        hdgtext = wx.StaticText(self, -1, "Map Viewer", (20, 120))
        font = wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC,
                       wx.FONTWEIGHT_BOLD)
        hdgtext.SetFont(font)

        vertext = wx.StaticText(self, -1, __version__, (20, 130))
        font = wx.Font(14, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_NORMAL)
        vertext.SetFont(font)

        copytext = wx.StaticText(
            self, -1, "Copyright (c) 2017 - D. Fish\nReleased under GPLv3",
            (20, 140))
        font = wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_NORMAL)
        copytext.SetFont(font)

        str = "This program was developed using wxPython and is part of the stdf2map package available at:"
        abouttext = wx.StaticText(self, -1, str, (40, 200))
        abouttext.Wrap(300)

        font = wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC,
                       wx.FONTWEIGHT_NORMAL)
        abouttext.SetFont(font)

        lblsizer = wx.BoxSizer(wx.VERTICAL)
        lblsizer.Add(hdgtext, 0, wx.ALL | wx.CENTER, 5)
        lblsizer.Add(vertext, 0, wx.ALL | wx.CENTER, 5)
        lblsizer.Add(copytext, 0, wx.ALL | wx.CENTER, 5)

        hdgsizer = wx.BoxSizer(wx.HORIZONTAL)
        hdgsizer.Add(img, 0, wx.ALL, 5)
        hdgsizer.Add(lblsizer, 0, wx.ALL, 5)

        link = hl.HyperLinkCtrl(
            self,
            wx.ID_ANY,
            "http://www.github.com/CozumelDiver/stdf2map",
            URL="http://www.github.com/CozumelDiver/stdf2map")

        midsizer = wx.BoxSizer(wx.VERTICAL)
        midsizer.Add(abouttext, 0, wx.ALL, 5)
        midsizer.Add(link, 0, wx.ALL, 10)

        okBtn = wx.Button(self, wx.ID_OK)

        topsizer = wx.BoxSizer(wx.VERTICAL)
        topsizer.Add(hdgsizer, 0, wx.ALL, 5)
        topsizer.Add(midsizer, 1, wx.ALL, 5)

        topsizer.Add(okBtn, 0, wx.ALL | wx.CENTER, 5)

        self.SetSizer(topsizer)