Example #1
0
    def __init__(self, sync_list_ctrl, event):
        Wizard.__init__(self, None, -1, _('Add new sync'))

        # Attributes
        self.pubkey = None
        self.privkey = None
        self.event = event
        self.localbox_client = None
        self.ctrl = sync_list_ctrl
        self.username = None
        self.path = None
        self.box_label = None

        self.page1 = LoginWizardPage(self)
        self.page2 = NewSyncInputsWizardPage(self)
        self.page3 = PassphraseWizardPage(self)

        WizardPageSimple.Chain(self.page1, self.page2)
        WizardPageSimple.Chain(self.page2, self.page3)

        self.SetPageSize(gui_utils.NEW_SYNC_WIZARD_SIZE)

        self.RunWizard(self.page1)

        self.Destroy()
Example #2
0
    def is_authenticated(self, event):

        if event.GetDirection():
            # going forwards
            getLogger(__name__).debug(
                'Checking if is already authenticated for: %s' % self.label)
            if self.parent.localbox_client and self.parent.localbox_client.authenticator.is_authenticated(
            ):
                WizardPageSimple.Chain(self.parent.page1,
                                       self.parent.page_ask_passphrase)
Example #3
0
    def createWizard(self):
        # Create the wizard and the pages
        wizard = Wizard(self, -1, "Opal welcome wizard",
                        wx.EmptyBitmap(200, 200))
        page1 = TitledPage(wizard, "Welcome to Opal")
        page2 = TitledPage(wizard, "Page 2")
        page3 = TitledPage(wizard, "Page 3")
        page4 = TitledPage(wizard, "Page 4")
        self.page1 = page1
        self.page1 = page1

        vbox = wx.BoxSizer(wx.HORIZONTAL)
        lable = wx.StaticText(page1, -1, "Choose your language:")
        choice = wx.Choice(page1, -1, (0, 0), choices=['English'])
        choice.SetSelection(0)
        vbox.Add(lable, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        vbox.Add(choice, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        page1.sizer.Add(vbox)
        #         vbox = wx.BoxSizer(wx.HORIZONTAL)
        #         t1 = wx.TextCtrl(page1, -1, "Test it out and see", size=(125, -1))
        #         vbox.Add(t1, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        #         page1.sizer.Add(vbox)

        page1.sizer.Add(
            wx.StaticText(
                page1, -1, """
            Choose a location of your workspace. 
            When you add books to Opal, they will be copied here. 
            Use an empty folder for a new Opal workspace."""), 0,
            wx.ALIGN_LEFT | wx.ALL, 1)
        dbb = DirBrowseButton(page1,
                              -1,
                              size=(450, -1),
                              changeCallback=self.dbbCallback)
        dbb.SetFocus()
        dbb.SetLabel("Book Library Location")
        dbb.SetHelpText('Please set your default workspace location.')
        dbb.textControl.SetValue(Workspace().path)

        page1.sizer.Add(dbb, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        wizard.FitToPage(page1)

        # Use the convenience Chain function to connect the pages
        WizardPageSimple.Chain(page1, page2)
        #         WizardPageSimple.Chain(page2, page3)
        #         WizardPageSimple.Chain(page3, page4)

        wizard.GetPageAreaSizer().Add(page1)
        if wizard.RunWizard(page1):
            pass
Example #4
0
    def passphrase_page(self, event):
        getLogger(__name__).debug('EVT_WIZARD_BEFORE_PAGE_CHANGED')

        if event.GetDirection():
            response = self.parent.localbox_client.call_user()
            result = json.loads(response.read())

            if 'private_key' in result and 'public_key' in result:
                getLogger(__name__).debug("private key and public key found")

                self.SetNext(self.parent.page_ask_passphrase)

                self.parent.privkey = result['private_key']
                self.parent.pubkey = result['public_key']
            else:
                getLogger(__name__).debug(
                    "private key or public key not found")
                getLogger(__name__).debug(str(result))
                WizardPageSimple.Chain(self, self.parent.page_new_passphrase)