Пример #1
0
    def __init__(self, *args, is_offline, **kwargs):
        super().__init__(*args, **kwargs)
        self.is_offline = is_offline
        self.online_languages = tesseract_download.get_downloadable_languages()

        # Translators: label of a list control containing bookmarks
        wx.StaticText(self, -1, _("Tesseract Languages"))
        listPanel = sc.SizedPanel(self)
        listPanel.SetSizerType("horizontal")
        listPanel.SetSizerProps(expand=True, align="center")
        self.tesseractLanguageList = ImmutableObjectListView(
            listPanel,
            wx.ID_ANY,
            style=wx.LC_REPORT | wx.SUNKEN_BORDER,
            size=(500, -1))
        self.btnPanel = btnPanel = sc.SizedPanel(self, -1)
        btnPanel.SetSizerType("horizontal")
        btnPanel.SetSizerProps(expand=True)
        if not self.is_offline:
            # Translators: text of a button to add a language to Tesseract OCR Engine (best quality model)
            self.addBestButton = wx.Button(btnPanel, wx.ID_ANY,
                                           _("Download &Best Model"))
            # Translators: text of a button to add a language to Tesseract OCR Engine (fastest model)
            self.addFastButton = wx.Button(btnPanel, wx.ID_ANY,
                                           _("Download &Fast Model"))
            self.Bind(wx.EVT_BUTTON, self.onAdd, self.addFastButton)
            self.Bind(wx.EVT_BUTTON, self.onAdd, self.addBestButton)
        else:
            # Translators: text of a button to remove a language from Tesseract OCR Engine
            self.removeButton = wx.Button(btnPanel, wx.ID_REMOVE, _("&Remove"))
            self.Bind(wx.EVT_BUTTON, self.onRemove, id=wx.ID_REMOVE)
        self.tesseractLanguageList.Bind(wx.EVT_SET_FOCUS, self.onListFocus,
                                        self.tesseractLanguageList)
Пример #2
0
    def setup_layout(self):
        main_panel = self.GetContentsPane()
        main_panel.SetSizerType('vertical')

        files_list_label = wx.StaticText(main_panel, label=_('&Files'))
        self.files_list = wx.ListBox(main_panel, style=wx.LB_NEEDED_SB)
        self.files_list.SetSizerProps(expand=True, proportion=1)
        self.files_list.Bind(wx.EVT_KEY_DOWN, self.onFilesListKeyPressed)
        self.files_list.Bind(wx.EVT_LISTBOX, self.onFilesListSelectionChange)

        files_list_buttons_panel = sc.SizedPanel(main_panel)
        files_list_buttons_panel.SetSizerType('horizontal')

        add_files_button = create_button(files_list_buttons_panel, _('Add f&iles...'), self.onAddFiles)
        add_folder_button = create_button(files_list_buttons_panel, _('Add f&older...'), self.onAddFolder)
        self.remove_file_button = create_button(files_list_buttons_panel, _('&Remove file'), self.onRemoveFile)
        self.remove_file_button.Hide()

        main_buttons_panel = sc.SizedPanel(main_panel)
        main_buttons_panel.SetSizerType('horizontal')

        self.output_formats = get_output_format_choices(main_buttons_panel, _('Output &format'))

        convert_button = create_button(main_buttons_panel, _('&Convert'), self.onConvert, wx.ID_CONVERT)
        remove_drm_button = create_button(main_buttons_panel, _('Remove &DRM'), self.onRemoveDRM, wx.ID_CONVERT)
        options_button = create_button(main_buttons_panel, _('O&ptions'), self.onOptions, id=wx.ID_PREFERENCES)
        if not application.is_frozen:
            calibre_environment_button = create_button(main_buttons_panel, '&Launch Calibre environment', self.onCalibreEnvironment)
        self.help_button = create_button(main_buttons_panel, _('&Help'), self.onHelp, wx.ID_HELP)
        exit_button = create_button(main_buttons_panel, _('E&xit'), self.onExit, id=wx.ID_EXIT)
Пример #3
0
 def addControls(self, parent):
     # Translators: header of a group of controls in a dialog to view user's comments/highlights
     filterBox = make_sized_static_box(parent, _("Filter By"))
     self.filterPanel = AnnotationFilterPanel(
         filterBox,
         -1,
         annotator=self.annotator,
         filter_callback=self.onFilter,
         filter_by_book=not self.reader.ready,
     )
     # Translators: header of a group of controls in a dialog to view user's comments/highlights
     sortBox = make_sized_static_box(parent, _("Sort By"))
     sortPanel = sc.SizedPanel(sortBox, -1)
     sortPanel.SetSizerType("horizontal")
     sortPanel.SetSizerProps(expand=True)
     sort_options = [
         # Translators: text of a toggle button to sort comments/highlights list
         (_("Date"), AnnotationSortCriteria.Date),
         # Translators: text of a toggle button to sort comments/highlights list
         (_("Page"), AnnotationSortCriteria.Page),
     ]
     if not self.reader.ready:
         # Translators: text of a toggle button to sort comments/highlights list
         sort_options.append((_("Book"), AnnotationSortCriteria.Book))
     for bt_label, srt_criteria in sort_options:
         tglButton = wx.ToggleButton(sortPanel, -1, bt_label)
         self._sort_toggles[tglButton] = srt_criteria
         self.Bind(wx.EVT_TOGGLEBUTTON, self.onSortToggle, tglButton)
     # Translators: text of a toggle button to sort comments/highlights list
     self.sortMethodToggle = wx.ToggleButton(sortPanel, -1, _("Ascending"))
     wx.StaticText(parent, -1, self.Title)
     self.itemsView = ImmutableObjectListView(
         parent, id=wx.ID_ANY, style=wx.LC_REPORT | wx.SUNKEN_BORDER
     )
     self.itemsView.SetSizerProps(expand=True)
     self.buttonPanel = sc.SizedPanel(parent, -1)
     self.buttonPanel.SetSizerType("horizontal")
     # Translators: text of a button in a dialog to view comments/highlights
     wx.Button(self.buttonPanel, wx.ID_PREVIEW, _("&View..."))
     if self.can_edit:
         # Translators: text of a button in a dialog to view comments/highlights
         wx.Button(self.buttonPanel, wx.ID_EDIT, _("&Edit..."))
         self.Bind(wx.EVT_BUTTON, self.onEdit, id=wx.ID_EDIT)
     # Translators: text of a button in a dialog to view comments/highlights
     wx.Button(self.buttonPanel, wx.ID_DELETE, _("&Delete..."))
     # Translators: text of a button in a dialog to view comments/highlights
     exportButton = wx.Button(self.buttonPanel, -1, _("E&xport..."))
     self.Bind(wx.EVT_TOGGLEBUTTON, self.onSortMethodToggle, self.sortMethodToggle)
     self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onItemClick, self.itemsView)
     self.Bind(wx.EVT_LIST_KEY_DOWN, self.onKeyDown, self.itemsView)
     self.Bind(wx.EVT_BUTTON, self.onView, id=wx.ID_PREVIEW)
     self.Bind(wx.EVT_BUTTON, self.onDelete, id=wx.ID_DELETE)
     self.Bind(wx.EVT_BUTTON, self.onExport, exportButton)
     self.on_filter_and_sort_state_changed()
     self.set_items()
Пример #4
0
 def addControls(self, parent):
     self.ext_info = sorted(get_ext_info().items())
     # Translators: instructions shown to the user in a dialog to set up file association.
     wx.StaticText(
         parent,
         -1,
         _("This dialog will help you to setup file associations.\n"
           "Associating files with Bookworm means that when you click on a file in windows explorer, it will be opened in Bookworm by default "
           ),
     )
     masterPanel = sc.SizedPanel(parent, -1)
     masterPanel.SetSizerType("horizontal")
     panel1 = sc.SizedPanel(masterPanel, -1)
     panel2 = sc.SizedPanel(masterPanel, -1)
     assoc_btn = CommandLinkButton(
         panel1,
         -1,
         # Translators: the main label of a button
         _("Associate all"),
         # Translators: the note of a button
         _("Use Bookworm to open all supported document formats"),
     )
     half = len(self.ext_info) / 2
     buttonPanel = panel1
     for i, (ext, metadata) in enumerate(self.ext_info):
         if i >= half:
             buttonPanel = panel2
         # Translators: the main label of a button
         mlbl = _("Associate files of type {format}").format(
             format=metadata[1])
         # Translators: the note of a button
         nlbl = _(
             "Associate files with {ext} extension so they always open in Bookworm"
         ).format(ext=ext)
         btn = CommandLinkButton(buttonPanel, -1, mlbl, nlbl)
         self.Bind(
             wx.EVT_BUTTON,
             lambda e, args=(ext, metadata[1]): self.onFileAssoc(*args),
             btn,
         )
     dissoc_btn = CommandLinkButton(
         panel2,
         -1,
         # Translators: the main label of a button
         _("Dissociate all supported file types"),
         # Translators: the note of a button
         _("Remove previously associated file types"),
     )
     self.Bind(wx.EVT_BUTTON, lambda e: self.onBatchAssoc(assoc=True),
               assoc_btn)
     self.Bind(wx.EVT_BUTTON, lambda e: self.onBatchAssoc(assoc=False),
               dissoc_btn)
Пример #5
0
    def __init__(self, *args, **kwargs):
        super(ContributeDialog, self).__init__(title="Contribute to PyCorrFit",
                                               *args,
                                               **kwargs)
        pane = self.GetContentsPane()

        pane_btns = sized_controls.SizedPanel(pane)
        pane_btns.SetSizerType('vertical')
        pane_btns.SetSizerProps(align="center")

        wx.StaticText(pane_btns, label=contribute_text)
        wx.StaticText(pane_btns, label="\nLinks:")
        for ii, link in enumerate(contribute_links):
            hl.HyperLinkCtrl(pane_btns,
                             -1,
                             "[{}]  {}".format(ii + 1, link),
                             URL=link)
        wx.StaticText(pane_btns, label="\n")

        button_ok = wx.Button(pane_btns, label='OK')
        button_ok.Bind(wx.EVT_BUTTON, self.on_button)
        button_ok.SetFocus()
        button_ok.SetSizerProps(expand=True)

        self.Fit()
Пример #6
0
 def make_controls(self):
     panel = self.GetContentsPane()
     panel.SetSizerType("horizontal")
     panel.SetSizerProps(expand=True)
     lhs_panel = sc.SizedPanel(panel)
     lhs_panel.SetSizerType("vertical")
     lhs_panel.SetSizerProps(expand=True)
     wx.StaticText(lhs_panel, -1, _("Provider"))
     self.provider_choice = wx.Choice(
         lhs_panel,
         -1,
         choices=[prov.display_name for prov in self.providers],
     )
     wx.StaticText(lhs_panel, -1, _("Categories"))
     self.tree_tabs = wx.Treebook(lhs_panel, -1)
     self.tree_tabs.SetSizerProps(expand=True)
     tree_ctrl = self.tree_tabs.GetTreeCtrl()
     tree_ctrl.SetMinSize((200, 1000))
     tree_ctrl.SetLabel(_("Categories"))
     self.Bind(wx.EVT_CHOICE, self.onProviderChoiceChange,
               self.provider_choice)
     self.Bind(wx.EVT_TREEBOOK_PAGE_CHANGED, self.OnPageChanged,
               self.tree_tabs)
     tree_ctrl.Bind(wx.EVT_KEY_UP, self.onTreeKeyUp, tree_ctrl)
     tree_ctrl.Bind(wx.EVT_TREE_ITEM_MENU, self.onTreeContextMenu)
     self.provider_choice.SetSelection(0)
     self.setup_provider()
Пример #7
0
 def createTemplateEntries(self, pane):
     panel = self._editPanel = sized_controls.SizedPanel(pane)
     panel.SetSizerType('form')
     panel.SetSizerProps(expand=True)
     label = wx.StaticText(panel, label=_('Subject'))
     label.SetSizerProps(valign='center')
     self._subjectCtrl = wx.TextCtrl(panel)
     label = wx.StaticText(panel, label=_('Planned start date'))
     label.SetSizerProps(valign='center')
     self._plannedStartDateTimeCtrl = TimeExpressionEntry(panel)
     label = wx.StaticText(panel, label=_('Due date'))
     label.SetSizerProps(valign='center')
     self._dueDateTimeCtrl = TimeExpressionEntry(panel)
     label = wx.StaticText(panel, label=_('Completion date'))
     label.SetSizerProps(valign='center')
     self._completionDateTimeCtrl = TimeExpressionEntry(panel)
     label = wx.StaticText(panel, label=_('Reminder'))
     label.SetSizerProps(valign='center')
     self._reminderDateTimeCtrl = TimeExpressionEntry(panel)
     self._taskControls = (self._subjectCtrl,
                           self._plannedStartDateTimeCtrl,
                           self._dueDateTimeCtrl,
                           self._completionDateTimeCtrl,
                           self._reminderDateTimeCtrl)
     for ctrl in self._taskControls:
         ctrl.SetSizerProps(valign='center', expand=True)
         ctrl.Bind(wx.EVT_TEXT, self.onValueChanged)
     self.enableEditPanel(False)
     panel.Fit()
Пример #8
0
 def __init__(self, parent, id ,script):
     sc.SizedDialog.__init__(self, None, -1, "Running ...", 
                     style=wx.DEFAULT_DIALOG_STYLE )
     
     pane = self.GetContentsPane()
     pane.SetSizerType("form")
     
     wx.StaticText(pane, -1, "Runing script:")
     wx.StaticText(pane, -1, script)
     
     wx.StaticText(pane, -1, "Run For (1-10000):")
     nestedPane = sc.SizedPanel(pane, -1)
     nestedPane.SetSizerType("horizontal")
     nestedPane.SetSizerProps(expand=True)
     self.textCtrl = wx.SpinCtrl(nestedPane, -1, "",(30, 50))
     self.textCtrl.SetRange(1,10000)
     choices = wx.Choice(nestedPane, -1, choices=["times", "hours"])
     choices.SetSelection(0)
     
     wx.CheckBox(pane, -1, "Checking Memory Leak").Enable(False)
     
     self.choice = "times"
     self.text = "1"
     self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
     self.Fit()
     self.SetMinSize(self.GetSize())
     self.Bind(wx.EVT_CHOICE, self.OnChoice, choices)
     self.Bind(wx.EVT_TEXT, self.OnType, self.textCtrl)
Пример #9
0
 def __init__(self, *args, **kwargs):
     self.__tip_provider = kwargs.pop('tip_provider')
     self.__settings = kwargs.pop('settings')
     super(TipDialog, self).__init__(title=_('Tip of the day'),
                                     *args,
                                     **kwargs)
     pane = self.GetContentsPane()
     pane.SetSizerType('horizontal')
     wx.StaticBitmap(pane,
                     bitmap=wx.ArtProvider_GetBitmap(
                         'lamp_icon', wx.ART_MENU, (32, 32)))
     tip_pane = sized_controls.SizedPanel(pane)
     self.__tip = wx.StaticText(tip_pane)
     self.__show_tip()
     next_tip_button = wx.Button(tip_pane,
                                 id=wx.ID_FORWARD,
                                 label=_('Next tip'))
     next_tip_button.Bind(wx.EVT_BUTTON, self.on_next_tip)
     self.__check = self.__create_checkbox(tip_pane)
     button_sizer = self.CreateStdDialogButtonSizer(wx.OK)
     self.SetButtonSizer(button_sizer)
     self.Fit()
     self.CentreOnParent()
     button_sizer.GetAffirmativeButton().Bind(wx.EVT_BUTTON, self.on_close)
     self.Bind(wx.EVT_CLOSE, self.on_close)
Пример #10
0
 def create_buttons(self):
     ButtonPanel = sc.SizedPanel(self.pane, -1)
     ButtonPanel.SetSizerType("horizontal")
     self.ButtonSend = wx.Button(ButtonPanel, id=wx.ID_OK, label=_("&Send"))
     self.Bind(wx.EVT_BUTTON, self.onSendButton, self.ButtonSend)
     self.ButtonCancel = wx.Button(ButtonPanel, id=wx.ID_CANCEL)
     self.Bind(wx.EVT_BUTTON, self.onCancelButtonClick, self.ButtonCancel)
Пример #11
0
    def __init__(self, parent, id):
        sc.SizedDialog.__init__(self,
                                parent,
                                id,
                                "Error log viewer",
                                style=wx.DEFAULT_DIALOG_STYLE
                                | wx.RESIZE_BORDER)

        # Always use self.GetContentsPane() - this ensures that your dialog
        # automatically adheres to HIG spacing requirements on all platforms.
        # pane here is a sc.SizedPanel with a vertical sizer layout. All children
        # should be added to this pane, NOT to self.
        pane = self.GetContentsPane()

        # first row
        self.listCtrl = wx.ListCtrl(pane,
                                    -1,
                                    size=(300, -1),
                                    style=wx.LC_REPORT)
        self.listCtrl.SetSizerProps(expand=True, proportion=1)
        self.ConfigureListCtrl()

        # second row
        self.lblDetails = wx.StaticText(pane, -1, "Error Details")

        # third row
        self.details = wx.TextCtrl(pane, -1, style=wx.TE_MULTILINE)
        self.details.SetSizerProps(expand=True, proportion=1)

        # final row
        # since we want to use a custom button layout, we won't use the
        # CreateStdDialogBtnSizer here, we'll just create our own panel with
        # a horizontal layout and add the buttons to that.
        btnpane = sc.SizedPanel(pane, -1)
        btnpane.SetSizerType("horizontal")
        btnpane.SetSizerProps(expand=True)

        self.saveBtn = wx.Button(btnpane, wx.ID_SAVE)
        spacer = sc.SizedPanel(btnpane, -1)
        spacer.SetSizerProps(expand=True, proportion=1)

        self.clearBtn = wx.Button(btnpane, -1, "Clear")

        self.Fit()
        self.SetMinSize(self.GetSize())
Пример #12
0
 def __create_message(self, pane):
     ''' Create the interior parts of the dialog, i.e. the message for the
         user. '''
     message = wx.StaticText(pane, label=self.__message)
     message.Wrap(500)
     url_panel = sized_controls.SizedPanel(pane)
     url_panel.SetSizerType('horizontal')
     wx.StaticText(url_panel, label=_('See:'))
     hyperlink.HyperLinkCtrl(url_panel, label=self.__url)
Пример #13
0
 def finish_setup(self, *args, **kwargs):
     self.button_panel = sc.SizedPanel(self.pane, -1)
     self.button_panel.SetSizerType("horizontal")
     self.setup_attachment()
     self.setup_url_shortener_buttons()
     self.setup_translation()
     self.setup_schedule()
     self.update_title()
     super(NewMessageDialog, self).finish_setup(*args, **kwargs)
Пример #14
0
 def finishSetup(self):
     self._first.Bind(wx.EVT_NAVIGATION_KEY, self.onForwardNavigation)
     self.Bind(wx.EVT_NAVIGATION_KEY, self.onBackwardNavigation)
     ButtonPanel = sc.SizedPanel(self, -1)
     ButtonPanel.SetSizerType("horizontal")
     self.ButtonOK = wx.Button(ButtonPanel, wx.ID_OK)
     self.ButtonCANCEL = wx.Button(ButtonPanel, wx.ID_CANCEL)
     self.ButtonAPPLY = wx.Button(ButtonPanel, wx.ID_APPLY)
     self.ButtonAPPLY.Bind(wx.EVT_SET_FOCUS, self.onFocus)
     self._ApplyWasPrevious = False
Пример #15
0
 def createInterior(self, panel):
     wx.StaticText(panel,
         label=_('You are using %(name)s version %(currentVersion)s.') % \
               self.messageInfo)
     urlPanel = sized_controls.SizedPanel(panel)
     urlPanel.SetSizerType('horizontal')
     wx.StaticText(urlPanel,
         label=_('Version %(version)s of %(name)s is available from') % \
               self.messageInfo)
     hyperlink.HyperLinkCtrl(urlPanel, label=meta.data.url)
Пример #16
0
    def __init__(self, parent, screenshot_full, screenshot, pos):
        sc.SizedDialog.__init__(self, parent, -1,
                                _('Submit Bug Report - Screenshot - Digsby'))
        self.SetFrameIcon(skin.get('appdefaults.taskbaricon'))

        # store both screenshots -- the one with blanked out areas, and the
        # full one
        self.big_screenshot_digsby = screenshot
        self.screenshot_digsby = pil_to_wxb_nocache(
            resize_screenshot(screenshot))

        self.big_screenshot_full = screenshot_full
        self.screenshot_full = pil_to_wxb_nocache(
            resize_screenshot(screenshot_full))

        self.screenshot = self.screenshot_digsby
        self.hide_non_digsby = True

        p = self.panel = self.GetContentsPane()

        screenshot_panel = sc.SizedPanel(self.panel, -1)
        screenshot_panel.SetMinSize(
            (self.screenshot_full.Width, self.screenshot_full.Height + 20))
        screenshot_panel.Bind(wx.EVT_PAINT, self.paint)

        hpanel = sc.SizedPanel(self.panel, -1)
        hpanel.SetSizerType("horizontal")
        checkbox = wx.CheckBox(hpanel, -1, _('Blank out non Digsby windows'))
        checkbox.SetValue(True)
        checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckFullScreenShot)
        checkbox.SetSizerProps(expand=True)
        stretchpanel = sc.SizedPanel(hpanel, -1)
        stretchpanel.SetSizerProps(expand=True, proportion=1)

        StaticText(hpanel, -1,
                   _('Is it OK to send this screenshot to digsby.com?'))

        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))

        self.Fit()

        self.SetPosition(pos)
Пример #17
0
 def addControls(self, parent):
     # Translators: the label of a combobox
     label = wx.StaticText(parent, -1, _("Recognition Language:"))
     self.langChoice = wx.Choice(
         parent, -1, choices=[l.description for l in self.languages])
     self.langChoice.SetSizerProps(expand=True)
     wx.StaticText(parent, -1, _("Supplied Image resolution::"))
     self.zoomFactorSlider = wx.Slider(parent, -1, minValue=0, maxValue=10)
     # Translators: the label of a checkbox
     self.should_enhance_images = wx.CheckBox(
         parent, -1, _("Enable image enhancements"))
     ippPanel = sc.SizedPanel(parent)
     # Translators: the label of a checkbox
     imgProcBox = make_sized_static_box(
         ippPanel, _("Available image pre-processing filters:"))
     for (ipp_cls, lbl,
          should_enable) in self.get_image_processing_pipelines_info():
         chbx = wx.CheckBox(imgProcBox, -1, lbl)
         if self.stored_options is not None:
             chbx.SetValue(ipp_cls in self.stored_ipp)
         else:
             chbx.SetValue(should_enable)
         self.image_processing_pipelines.append((chbx, ipp_cls))
     wx.StaticLine(parent)
     if not self.force_save:
         self.storeOptionsCheckbox = wx.CheckBox(
             parent,
             -1,
             # Translators: the label of a checkbox
             _("&Save these options until I close the current book"),
         )
     self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)
     if self.stored_options is None:
         self.langChoice.SetSelection(0)
         self.zoomFactorSlider.SetValue(2)
         self.should_enhance_images.SetValue(
             config.conf["ocr"]["enhance_images"])
     else:
         self.langChoice.SetSelection(
             self.languages.index(self.stored_options.language))
         self.zoomFactorSlider.SetValue(self.stored_options.zoom_factor)
         self.should_enhance_images.SetValue(
             self.stored_options._ipp_enabled)
         if not self.force_save:
             self.storeOptionsCheckbox.SetValue(
                 self.stored_options.store_options)
     enable_or_disable_image_pipelines = lambda: ippPanel.Enable(
         self.should_enhance_images.IsChecked())
     self.Bind(
         wx.EVT_CHECKBOX,
         lambda e: enable_or_disable_image_pipelines(),
         self.should_enhance_images,
     )
     enable_or_disable_image_pipelines()
Пример #18
0
    def createOtherCtrls(self):
        pane = self.GetContentsPane()

        cPane = sc.SizedPanel(pane)
        cPane.SetSizerType("grid", options={"cols": 2})
        st = wx.StaticText(cPane, wx.ID_ANY,
                           _(u"A nice label for the TextCtrl"))
        st.SetSizerProps(valign='center')
        tc = wx.TextCtrl(cPane, wx.ID_ANY)

        searchSt = wx.StaticText(cPane, wx.ID_ANY, _(u"a search control"))
        searchSt.SetSizerProps(valign='center')
        searchC = wx.SearchCtrl(cPane, wx.ID_ANY)

        sline = wx.StaticLine(pane, wx.ID_ANY)
        sline.SetSizerProps(expand=True)
        bPane = sc.SizedPanel(pane)
        fB = wx.Button(bPane, wx.ID_ANY, _(u"Open a file dialog"))
        fB.SetSizerProps(align="center")
        fB.Bind(wx.EVT_BUTTON, self.onFbButton)
Пример #19
0
 def __init__(self, session, prompt=None, title="", *args, **kwargs):
     title = '%s: %s ' % (session.name.upper(), title)
     super(LoginDialog, self).__init__(title=title, *args, **kwargs)
     if prompt:
         prompt_panel = sc.SizedPanel(self.pane, -1)
         wx.StaticText(prompt_panel, label=prompt)
     self.username = self.labeled_control(label=_("Username"),
                                          control=wx.TextCtrl)
     self.password = self.labeled_control(label=_("Password"),
                                          control=wx.TextCtrl,
                                          style=wx.TE_PASSWORD)
     self.finish_setup()
Пример #20
0
 def addControls(self, parent):
     parent.SetSizerType("vertical")
     wx.StaticText(parent, -1, _("Search"))
     self.searchQueryTextCtrl = wx.TextCtrl(parent, -1)
     self.searchQueryTextCtrl.SetSizerProps(expand=True)
     searchFieldBox = make_sized_static_box(parent, _("Search Field"))
     pnl = sc.SizedPanel(searchFieldBox, -1)
     pnl.SetSizerType("horizontal")
     self.shouldSearchInTitle = wx.CheckBox(pnl, -1, _("Title"))
     self.shouldSearchInContent = wx.CheckBox(pnl, -1, _("Content"))
     self.shouldSearchInTitle.SetValue(True)
     self.shouldSearchInContent.SetValue(True)
Пример #21
0
    def __init__(self):
        sc.SizedDialog.__init__(self,
                                None,
                                -1,
                                "用户注册",
                                style=wx.DEFAULT_DIALOG_STYLE
                                | wx.RESIZE_BORDER)

        pane = self.GetContentsPane()
        pane.SetSizerType("form")

        # row 1
        wx.StaticText(pane, -1, "姓名")
        textCtrl = wx.TextCtrl(pane, -1, "请输入姓名")
        textCtrl.SetSizerProps(expand=True)

        # row 2
        wx.StaticText(pane, -1, "所学专业")
        emailCtrl = wx.TextCtrl(pane, -1, "")
        emailCtrl.SetSizerProps(expand=True)

        # row 3
        wx.StaticText(pane, -1, "性别")
        wx.Choice(pane, -1, choices=["男", "女"])

        # row 4
        wx.StaticText(pane, -1, "联系方式")
        wx.TextCtrl(pane, -1, size=(100, -1))  # two chars for state

        # row 5
        wx.StaticText(pane, -1, "职称")

        # here's how to add a 'nested sizer' using sized_controls
        radioPane = sc.SizedPanel(pane, -1)
        radioPane.SetSizerType("horizontal")
        radioPane.SetSizerProps(expand=True)

        # make these children of the radioPane to have them use
        # the horizontal layout
        wx.RadioButton(radioPane, -1, "主任")
        wx.RadioButton(radioPane, -1, "副主任")
        wx.RadioButton(radioPane, -1, "普通")
        # end row 5

        # add dialog buttons
        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))

        # a little trick to make sure that you can't resize the dialog to
        # less screen space than the controls need
        self.Fit()
        self.SetMinSize(self.GetSize())
Пример #22
0
    def __init__(self, parent, id):
        sc.SizedDialog.__init__(self,
                                None,
                                -1,
                                "SizedForm Dialog",
                                style=wx.DEFAULT_DIALOG_STYLE
                                | wx.RESIZE_BORDER)

        pane = self.GetContentsPane()
        pane.SetSizerType("form")

        # row 1
        wx.StaticText(pane, -1, "Name")
        textCtrl = wx.TextCtrl(pane, -1, "Your name here")
        textCtrl.SetSizerProps(expand=True)

        # row 2
        wx.StaticText(pane, -1, "Email")
        emailCtrl = wx.TextCtrl(pane, -1, "")
        emailCtrl.SetSizerProps(expand=True)

        # row 3
        wx.StaticText(pane, -1, "Gender")
        wx.Choice(pane, -1, choices=["male", "female"])

        # row 4
        wx.StaticText(pane, -1, "State")
        wx.TextCtrl(pane, -1, size=(60, -1))  # two chars for state

        # row 5
        wx.StaticText(pane, -1, "Title")

        # here's how to add a 'nested sizer' using sized_controls
        radioPane = sc.SizedPanel(pane, -1)
        radioPane.SetSizerType("horizontal")
        radioPane.SetSizerProps(expand=True)

        # make these children of the radioPane to have them use
        # the horizontal layout
        wx.RadioButton(radioPane, -1, "Mr.")
        wx.RadioButton(radioPane, -1, "Mrs.")
        wx.RadioButton(radioPane, -1, "Dr.")
        # end row 5

        # add dialog buttons
        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))

        # a little trick to make sure that you can't resize the dialog to
        # less screen space than the controls need
        self.Fit()
        self.SetMinSize(self.GetSize())
Пример #23
0
 def __init__(self, *args, **kwargs):    
     wx.Dialog.__init__(self, *args, **kwargs)
 
     if sys.platform == 'win32': 
         self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)
 
     self.borderLen = 12
     self.mainPanel = sc.SizedPanel(self, -1) 
 
     mysizer = wx.BoxSizer(wx.VERTICAL)
     mysizer.Add(self.mainPanel, 1, wx.EXPAND | wx.ALL, 0)
     self.SetSizer(mysizer)
 
     self.SetAutoLayout(True)
Пример #24
0
 def createHeaderEntry(self, pane):
     label = wx.StaticText(pane, label=_('Headers'))
     label.SetSizerProps(valign='center')
     hdr = self._settings.getint(self._settingsSection, 'headerformat')
     panel = sized_controls.SizedPanel(pane)
     panel.SetSizerType('vertical')
     self._weekNumber = wx.CheckBox(panel, label=_('Week number'))
     self._weekNumber.SetValue(hdr & 1)
     self._weekNumber.SetSizerProps(valign='center')
     self._dates = wx.CheckBox(panel, label=_('Date'))
     self._dates.SetValue(hdr & 2)
     self._dates.SetSizerProps(valign='center')
     panel.SetSizerProps(valign='center')
     panel.Fit()
Пример #25
0
    def __init__(self, *args, **kwargs):
        super(LoginFrame, self).__init__(*args, **kwargs)
        self.parent = args[0]
        self.logged_in = False

        pane = self.GetContentsPane()

        pane_form = sized_controls.SizedPanel(pane)
        pane_form.SetSizerType('form')

        label = wx.StaticText(pane_form, label='User Name')
        label.SetSizerProps(halign='right', valign='center')

        self.user_name_ctrl = wx.TextCtrl(pane_form, size=((200, -1)))

        label = wx.StaticText(pane_form, label='Password')
        label.SetSizerProps(halign='right', valign='center')

        self.password_ctrl = wx.TextCtrl(pane_form,
                                         size=((200, -1)),
                                         style=wx.TE_PASSWORD)

        pane_btns = sized_controls.SizedPanel(pane)
        pane_btns.SetSizerType('horizontal')
        pane_btns.SetSizerProps(halign='right')

        login_btn = wx.Button(pane_btns, label='Login')
        login_btn.SetDefault()
        cancel_btn = wx.Button(pane_btns, label='Cancel')
        self.Fit()
        self.SetTitle('Login')
        self.CenterOnParent()
        self.parent.Disable()

        login_btn.Bind(wx.EVT_BUTTON, self.on_btn_login)
        cancel_btn.Bind(wx.EVT_BUTTON, self.on_btn_cancel)
        self.Bind(wx.EVT_CLOSE, self.on_close)
Пример #26
0
    def __init__(self, parent, id):
        sc.SizedDialog.__init__(self,
                                None,
                                -1,
                                "SizedForm Dialog with a scolled panel",
                                style=wx.DEFAULT_DIALOG_STYLE
                                | wx.RESIZE_BORDER,
                                size=wx.Size(-1, 220))

        cPane = self.GetContentsPane()
        pane = sc.SizedScrolledPanel(cPane, wx.ID_ANY)
        pane.SetSizerProps(expand=True, proportion=1)
        pane.SetSizerType("form")

        # row 1
        wx.StaticText(pane, -1, "Name")
        textCtrl = wx.TextCtrl(pane, -1, "Your name here")
        textCtrl.SetSizerProps(expand=True)

        # row 2
        wx.StaticText(pane, -1, "Email")
        emailCtrl = wx.TextCtrl(pane, -1, "")
        emailCtrl.SetSizerProps(expand=True)

        # row 3
        wx.StaticText(pane, -1, "Gender")
        wx.Choice(pane, -1, choices=["male", "female"])

        # row 4
        wx.StaticText(pane, -1, "State")
        wx.TextCtrl(pane, -1, size=(60, -1))  # two chars for state

        # row 5
        wx.StaticText(pane, -1, "Title")

        # here's how to add a 'nested sizer' using sized_controls
        radioPane = sc.SizedPanel(pane, -1)
        radioPane.SetSizerType("horizontal")
        radioPane.SetSizerProps(expand=True)

        # make these children of the radioPane to have them use
        # the horizontal layout
        wx.RadioButton(radioPane, -1, "Mr.")
        wx.RadioButton(radioPane, -1, "Mrs.")
        wx.RadioButton(radioPane, -1, "Dr.")
        # end row 5

        # add dialog buttons
        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
Пример #27
0
    def setup_layout(self):
        main_panel = self.GetContentsPane()
        main_panel.SetSizerType('vertical')

        files_list_label = wx.StaticText(main_panel, label=_('Files'))
        self.files_list = wx.ListBox(main_panel, style=wx.LB_NEEDED_SB)
        self.files_list.SetSizerProps(expand=True, proportion=1)
        self.files_list.Bind(wx.EVT_CHAR, self.onFilesListKeyPressed)
        self.files_list.Bind(wx.EVT_LISTBOX, self.onFilesListSelectionChange)

        files_list_buttons_panel = sc.SizedPanel(main_panel)
        files_list_buttons_panel.SetSizerType('horizontal')

        self.add_button = create_button(files_list_buttons_panel, _('&Add'),
                                        self.onAdd)
        self.remove_file_button = create_button(files_list_buttons_panel,
                                                _('&Remove file'),
                                                self.onRemoveFile)
        self.remove_file_button.Disable()

        self.main_buttons_panel = sc.SizedPanel(main_panel)
        self.main_buttons_panel.SetSizerType('horizontal')
        self.main_buttons_panel.Disable()

        self.output_formats = get_output_format_choices(
            self.main_buttons_panel, _('O&utput format'))
        self.output_formats.Disable()

        self.convert_button = create_button(self.main_buttons_panel,
                                            _('&Convert'), self.onConvert,
                                            wx.ID_CONVERT)
        self.convert_button.Disable()
        self.remove_drm_button = create_button(self.main_buttons_panel,
                                               _('Remove &DRM'),
                                               self.onRemoveDRM, wx.ID_CONVERT)
        self.remove_drm_button.Disable()
Пример #28
0
    def __init__(self, *args, **kwargs):
        # context help
        pre = wx.PreDialog()
        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        pre.Create(*args, **kwargs)
        self.PostCreate(pre)

        self.borderLen = 12
        self.mainPanel = sc.SizedPanel(self, -1)

        mysizer = wx.BoxSizer(wx.VERTICAL)
        mysizer.Add(self.mainPanel, 1, wx.EXPAND | wx.ALL, self.GetDialogBorder())
        self.SetSizer(mysizer)

        self.SetAutoLayout(True)
Пример #29
0
    def __init__(self, *args, **kwds):
        if 'style' in kwds:
            kwds['style'] |= wx.BORDER_NONE
        else:
            kwds['style'] = wx.BORDER_NONE

        super(PopupControl, self).__init__(*args, **kwds)
        LabelMixin.__init__(self)

        cSizer = wx.BoxSizer()
        self.cPanel = sc.SizedPanel(self, wx.ID_ANY)
        cSizer.Add(self.cPanel, 1, wx.EXPAND)
        self.SetSizer(cSizer)

        self.cPanel.SetSizerType('grid', {
            'cols': 2,
        })
        self.textCtrl = wx.lib.masked.TextCtrl(self.cPanel,
                                               wx.ID_ANY,
                                               useFixedWidthFont=False)
        self.textCtrl.SetCtrlParameters(mask=u"*{%i}" % 20,
                                        formatcodes="F_S>",
                                        includeChars=u'-',
                                        emptyInvalid=False)
        # expand and prop grow it in height!!!!????
        self.textCtrl.SetSizerProps(proportion=1,
                                    expand=True,
                                    valign="centre",
                                    border=('all', 0))
        self.bCtrl = PopButton(self.cPanel, wx.ID_ANY, style=wx.BORDER_NONE)
        # NOTE: bug in sized controls, below gives wx.ALL border
        self.bCtrl.SetSizerProps(border=([
            'left',
        ], 3))
        self.cPanel.SetSizerProps({
            'growable_col': (0, 1),
        })

        self.pop = None
        self.content = None

        self.bCtrl.Bind(wx.EVT_BUTTON, self.onButton, self.bCtrl)
        self.Bind(wx.EVT_SET_FOCUS, self.onFocus)
        self.Bind(wx.EVT_SIZE, self.onSize)

        self.cPanel.Layout()
        self.Layout()
        self.Fit()
Пример #30
0
    def test_lib_pdfviewer_loadFile(self):
        paneCont = sc.SizedPanel(self.frame)

        self.buttonpanel = pdfButtonPanel(paneCont, wx.NewId(),
                                wx.DefaultPosition, wx.DefaultSize, 0)
        self.buttonpanel.SetSizerProps(expand=True)
        self.viewer = pdfViewer(paneCont, wx.NewId(), wx.DefaultPosition,
                                wx.DefaultSize,
                                wx.HSCROLL|wx.VSCROLL|wx.SUNKEN_BORDER)
        self.viewer.SetSizerProps(expand=True, proportion=1)

        # introduce buttonpanel and viewer to each other
        self.buttonpanel.viewer = self.viewer
        self.viewer.buttonpanel = self.buttonpanel

        self.viewer.LoadFile(samplePdf)
        self.waitFor(500)