def __init__(self,parent,type): WizardPageSimple.__init__(self,parent) self.parent = parent self.utility = parent.utility mainbox = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(self, -1, self.utility.lang.get('rwid_explanation')) text.Wrap(400) mainbox.Add(text, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5) # Real-World Identifiers rwidbox = wx.BoxSizer(wx.VERTICAL) self.rwidlist = RWIDList(self) rwidbox.Add(self.rwidlist, 1, wx.EXPAND|wx.ALL, 5) rwidbtnbox = wx.BoxSizer(wx.HORIZONTAL) button = wx.Button(self, -1, self.utility.lang.get('addrwid'), style = wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnAddRWID, button) rwidbtnbox.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) button = wx.Button(self, -1, self.utility.lang.get('remrwid'), style = wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnRemoveRWID, button) rwidbtnbox.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) rwidbox.Add(rwidbtnbox, 0, wx.EXPAND) mainbox.Add(rwidbox, 0, wx.EXPAND) self.SetSizerAndFit(mainbox) self.rwidlist.loadList()
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()
def __init__(self, parent): """Constructor""" WizardPageSimple.__init__(self, parent) # Attributes self.parent = parent self._sizer = wx.BoxSizer(wx.VERTICAL) image = gui_utils.image_from_url(None).Scale(100, 100).ConvertToBitmap() self.imageBitmap = wx.StaticBitmap(self, wx.ID_ANY, image) self._sizer.Add(self.imageBitmap, 0, wx.ALL | wx.CENTER) self.server_label = wx.StaticText(self, label=_("Server")) self._sizer.Add(self.server_label, 1, wx.ALL | wx.CENTER) self._label = wx.TextCtrl(self) self._selected_dir = wx.TextCtrl(self, style=wx.TE_READONLY) self._selected_dir.Show(False) self.btn_select_dir = wx.Button(self, label=_('Select'), size=(95, 30)) # Layout self._DoLayout() self.Bind(wx.EVT_BUTTON, self.select_localbox_dir, self.btn_select_dir) self.Bind(EVT_WIZARD_PAGE_CHANGING, self.validate_new_sync_inputs) self.Bind(EVT_WIZARD_PAGE_CHANGED, self.layout)
def __init__(self, parent): WizardPageSimple.__init__(self, parent) # Attributes self.parent = parent self._label = wx.StaticText(self, label=_("New Passphrase")) self._entry_passphrase = wx.TextCtrl(self, style=wx.TE_PASSWORD) self._label_repeat = wx.StaticText(self, label=_('Repeat passphrase')) self._entry_repeat_passphrase = wx.TextCtrl(self, style=wx.TE_PASSWORD) # Layout main_sizer = wx.BoxSizer(wx.VERTICAL) input_sizer = wx.BoxSizer(wx.VERTICAL) input_sizer.Add(self._label, 0, flag=wx.EXPAND | wx.ALL) input_sizer.Add(self._entry_passphrase, 0, flag=wx.EXPAND | wx.ALL) input_sizer.Add(self._label_repeat, 0, flag=wx.EXPAND | wx.ALL) input_sizer.Add(self._entry_repeat_passphrase, 0, flag=wx.EXPAND | wx.ALL) main_sizer.Add(input_sizer, 1, flag=wx.EXPAND | wx.ALL, border=gui_utils.DEFAULT_BORDER) self.SetSizer(main_sizer) self.Layout() self.Bind(EVT_WIZARD_BEFORE_PAGE_CHANGED, self.store_keys)
def __init__(self, parent): self.parent = parent self._sizer = None self._levels = [] WizardPageSimple.__init__(self, parent) self.LabelText = wx.StaticText(self, -1, label="Select titles of directories on selected levels:") self.__set_properties() self.__do_layout()
def __init__(self, parent, type): WizardPageSimple.__init__(self, parent) self.utility = parent.utility # 0. mainbox mainbox = wx.BoxSizer(wx.VERTICAL) # 1. topbox topbox = wx.BoxSizer(wx.VERTICAL) # Ask public name name = self.utility.session.get_nickname() name_box = wx.BoxSizer(wx.HORIZONTAL) self.myname = wx.TextCtrl(self, -1, name) name_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myname')), 0, wx.ALIGN_CENTER_VERTICAL) name_box.Add(self.myname, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5) topbox.Add(name_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5) # Ask public user icon / avatar icon_box = wx.BoxSizer(wx.HORIZONTAL) icon_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myicon')), 0, wx.ALIGN_CENTER_VERTICAL) ## TODO: integrate this code with makefriends.py, especially checking code self.iconbtn = None self.iconmime, self.icondata = self.utility.session.get_mugshot() if self.icondata: bm = data2wxBitmap(self.iconmime, self.icondata) else: im = IconsManager.getInstance() bm = im.get_default('PEER_THUMB') if sys.platform == 'darwin': path = get_home_dir() self.iconbtn = wx.FilePickerCtrl(self, -1, path) self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnIconSelected, id=self.iconbtn.GetId()) icon_box.Add(self.iconbtn, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5) else: self.iconbtn = wx.BitmapButton(self, -1, bm) icon_box.Add(self.iconbtn, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5) #label = wx.StaticText(self, -1, self.utility.lang.get('obligiconformat')) #icon_box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5) self.Bind(wx.EVT_BUTTON, self.OnIconButton, self.iconbtn) topbox.Add(icon_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5) mainbox.Add(topbox, 0, wx.EXPAND) self.SetSizerAndFit(mainbox)
def __init__(self, parent): self.parent = parent self.drag_item_list = None WizardPageSimple.__init__(self, parent) self.LabelText = wx.StaticText(self, -1, label="Drag and drop FDF options in a tree to create selected " "directory hierarchy:") self.DirTree = DDTreeCtrl(self, -1, style=wx.TR_HAS_BUTTONS) self.ids = {'root': self.DirTree.AddRoot('Root directory')} self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.on_drag_begin, self.DirTree) self.Bind(wx.EVT_TREE_END_DRAG, self.on_drag_end, self.DirTree) self.__set_properties() self.__do_layout()
def __init__(self,parent,type): WizardPageSimple.__init__(self,parent) self.utility = parent.utility # 0. mainbox mainbox = wx.BoxSizer(wx.VERTICAL) # 1. topbox topbox = wx.BoxSizer(wx.VERTICAL) # Ask public name name = self.utility.session.get_nickname() name_box = wx.BoxSizer(wx.HORIZONTAL) self.myname = wx.TextCtrl(self, -1, name) name_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myname')), 0, wx.ALIGN_CENTER_VERTICAL) name_box.Add(self.myname, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5) topbox.Add(name_box, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5) # Ask public user icon / avatar icon_box = wx.BoxSizer(wx.HORIZONTAL) icon_box.Add(wx.StaticText(self, -1, self.utility.lang.get('myicon')), 0, wx.ALIGN_CENTER_VERTICAL) ## TODO: integrate this code with makefriends.py, especially checking code self.iconbtn = None self.iconmime, self.icondata = self.utility.session.get_mugshot() if self.icondata: bm = data2wxBitmap(self.iconmime, self.icondata) else: im = IconsManager.getInstance() bm = im.get_default('personsMode','DEFAULT_THUMB') if sys.platform == 'darwin': path = get_home_dir() self.iconbtn = wx.FilePickerCtrl(self, -1, path) self.Bind(wx.EVT_FILEPICKER_CHANGED,self.OnIconSelected,id=self.iconbtn.GetId()) icon_box.Add(self.iconbtn, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5) else: self.iconbtn = wx.BitmapButton(self, -1, bm) icon_box.Add(self.iconbtn, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5) #label = wx.StaticText(self, -1, self.utility.lang.get('obligiconformat')) #icon_box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5) self.Bind(wx.EVT_BUTTON, self.OnIconButton, self.iconbtn) topbox.Add(icon_box, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 5) mainbox.Add(topbox, 0, wx.EXPAND) self.SetSizerAndFit(mainbox)
def __init__(self, parent): self.parent = parent self.page_names = [] self.pages = [] WizardPageSimple.__init__(self, parent) self.LabelText = wx.StaticText(self, -1, label="Add values to selected FDF options:") self.Notebook = wx.Notebook(self, -1, style=wx.NB_TOP) self.AddBtn = wx.Button(self, -1, "Add") self.RemoveBtn = wx.Button(self, -1, "Remove") # binding events self.Bind(wx.EVT_BUTTON, self.on_AddBtn, self.AddBtn) self.Bind(wx.EVT_BUTTON, self.on_RemoveBtn, self.RemoveBtn) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.on_Notebook, self.Notebook) self.__set_properties() self.__do_layout()
def __init__(self, parent): WizardPageSimple.__init__(self, parent) # Attributes self.pubkey = None self.privkey = None self.parent = parent self._label = wx.StaticText(self, label=_('Give Passphrase')) self._entry_passphrase = wx.TextCtrl(self, style=wx.TE_PASSWORD) self._label_repeat = wx.StaticText(self, label=_('Repeat passphrase')) self._entry_repeat_passphrase = wx.TextCtrl(self, style=wx.TE_PASSWORD) self.Bind(EVT_WIZARD_PAGE_CHANGING, self.store_keys) self.Bind(EVT_WIZARD_PAGE_CHANGED, self.layout)
def __init__(self, parent): self.parent = parent WizardPageSimple.__init__(self, parent) self.selected_options = [] self.LabelText = wx.StaticText(self, -1, label="Select FDF options to include in batch run:") self.OptionsTree = wx.TreeCtrl(self, -1, style=wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS) self.SelectBtn = wx.Button(self, -1, ">>") self.DeselectBtn = wx.Button(self, -1, "<<") self.OptionsList = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) # initialize OptionsList self.OptionsList.InsertColumn(0, 'Options', width=180) # binding events self.Bind(wx.EVT_BUTTON, self.on_SelectBtn, self.SelectBtn) self.Bind(wx.EVT_BUTTON, self.on_DeselectBtn, self.DeselectBtn) self.__set_properties() self.__do_layout()
def __init__(self, parent): """Constructor""" WizardPageSimple.__init__(self, parent) # Attributes self.parent = parent self._sizer = wx.BoxSizer(wx.VERTICAL) self._label = wx.TextCtrl(self) self._url = wx.TextCtrl(self) self._selected_dir = wx.TextCtrl(self, style=wx.TE_READONLY) self.btn_select_dir = wx.Button(self, label=_('Select'), size=(95, 30)) # Layout self._DoLayout() self.Bind(wx.EVT_BUTTON, self.select_localbox_dir, self.btn_select_dir) self.Bind(EVT_WIZARD_BEFORE_PAGE_CHANGED, self.is_authenticated) self.Bind(EVT_WIZARD_PAGE_CHANGING, self.validate_new_sync_inputs)
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)
def __init__(self, parent): WizardPageSimple.__init__(self, parent) # Attributes self.parent = parent self.is_authenticated = False self._username = wx.TextCtrl(self) self._password = wx.TextCtrl(self, style=wx.TE_PASSWORD) main_sizer = wx.BoxSizer(wx.VERTICAL) self.main_sizer = main_sizer input_sizer = wx.BoxSizer(wx.VERTICAL) input_sizer.Add(wx.StaticText(self, label=_("Username:"******"Password:")), 0, wx.ALL | wx.ALIGN_LEFT, border=gui_utils.DEFAULT_BORDER) input_sizer.Add(self._password, 0, wx.ALL | wx.EXPAND) main_sizer.Add(input_sizer, 1, wx.ALL | wx.EXPAND, border=gui_utils.DEFAULT_BORDER) self.already_authenticated_sizer = wx.BoxSizer(wx.VERTICAL) self._label_already_authenticated = wx.StaticText(self, label='') self.already_authenticated_sizer.Add(self._label_already_authenticated, 1, wx.ALL | wx.EXPAND, border=gui_utils.DEFAULT_BORDER) self.Bind(EVT_WIZARD_BEFORE_PAGE_CHANGED, self.call_password_authentication) # self.Bind(EVT_WIZARD_BEFORE_PAGE_CHANGED, self.should_login) # self.Bind(EVT_WIZARD_PAGE_CHANGING, self.passphrase_page) self.layout_inputs()
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
def __init__(self, parent, type): WizardPageSimple.__init__(self, parent) self.parent = parent self.utility = parent.utility mainbox = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(self, -1, self.utility.lang.get('rwid_explanation')) text.Wrap(400) mainbox.Add(text, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # Real-World Identifiers rwidbox = wx.BoxSizer(wx.VERTICAL) self.rwidlist = RWIDList(self) rwidbox.Add(self.rwidlist, 1, wx.EXPAND | wx.ALL, 5) rwidbtnbox = wx.BoxSizer(wx.HORIZONTAL) button = wx.Button(self, -1, self.utility.lang.get('addrwid'), style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnAddRWID, button) rwidbtnbox.Add(button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) button = wx.Button(self, -1, self.utility.lang.get('remrwid'), style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnRemoveRWID, button) rwidbtnbox.Add(button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) rwidbox.Add(rwidbtnbox, 0, wx.EXPAND) mainbox.Add(rwidbox, 0, wx.EXPAND) self.SetSizerAndFit(mainbox) self.rwidlist.loadList()
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)
def __init__(self, parent): WizardPageSimple.__init__(self, parent) # Attributes self.parent = parent self.is_authenticated = False self._username = wx.TextCtrl(self) self._password = wx.TextCtrl(self, style=wx.TE_PASSWORD) main_sizer = wx.BoxSizer(wx.VERTICAL) self.main_sizer = main_sizer input_sizer = wx.BoxSizer(wx.VERTICAL) # Server logo selected_server = self.getSelectedServer() image = gui_utils.image_from_url( selected_server.picture if selected_server else None).Scale( 100, 100).ConvertToBitmap() self.imageBitmap = wx.StaticBitmap(self, wx.ID_ANY, image, size=(100, 100)) input_sizer.Add(self.imageBitmap, 0, wx.ALL | wx.CENTER) input_sizer.Add(wx.StaticText(self, label=_("Server")), 0, wx.ALL | wx.CENTER) # Horizontal grid for servers dropdown and add server button hbox = wx.BoxSizer(wx.HORIZONTAL) ## Servers dropdown select servers = self.parent.ctrl.getServers() self.server_choices = wx.Choice( self, wx.ID_ANY, choices=[server.label for server in servers]) self.server_choices.Bind(wx.EVT_CHOICE, self.OnChoice) self.server_choices.SetSelection(0) hbox.Add(self.server_choices, 0, wx.ALL) ## Add server button self.add_server_button = wx.Button(self, wx.ID_ANY, style=wx.BU_EXACTFIT, size=(35, self.server_choices.Size[1])) self.add_server_button.SetBitmapLabel( wx.ArtProvider.GetBitmap(wx.ART_PLUS, wx.ART_MENU)) self.add_server_button.Bind(wx.EVT_BUTTON, self.OnButton) hbox.Add(self.add_server_button, 0, wx.ALL) input_sizer.Add(hbox, 1, wx.ALL | wx.CENTER) input_sizer.Add(wx.StaticText(self, label=_("Username")), 0, wx.ALL | wx.ALIGN_LEFT) input_sizer.Add(self._username, 0, wx.ALL | wx.EXPAND) input_sizer.Add(wx.StaticText(self, label=_("Password")), 0, wx.ALL | wx.ALIGN_LEFT) input_sizer.Add(self._password, 0, wx.ALL | wx.EXPAND) main_sizer.Add(input_sizer, 1, wx.ALL | wx.EXPAND, border=gui_utils.DEFAULT_BORDER) self.SetSizer(self.main_sizer) self.already_authenticated_sizer = wx.BoxSizer(wx.VERTICAL) self._label_already_authenticated = wx.StaticText(self, label='') self.already_authenticated_sizer.Add(self._label_already_authenticated, 1, wx.ALL | wx.EXPAND, border=gui_utils.DEFAULT_BORDER) if wx.__version__ < '3.0.3': self.Bind(EVT_WIZARD_PAGE_CHANGING, self.call_password_authentication) else: self.Bind(EVT_WIZARD_BEFORE_PAGE_CHANGED, self.call_password_authentication) # self.Bind(EVT_WIZARD_BEFORE_PAGE_CHANGED, self.should_login) # self.Bind(EVT_WIZARD_PAGE_CHANGING, self.passphrase_page) self.layout_inputs() if self.getSelectedServer(): self.parent.selected_server = self.getSelectedServer() self.check_server_connection(self.getSelectedServer())
def __init__(self, parent, title): WizardPageSimple.__init__(self, parent) self.sizer = self.makePageTitle(title)