示例#1
0
    def __init__(self, parent):
        super(ModuleTree, self).__init__(parent, None)

        self.on_module_choice = ObserverList()
        self.on_category_choice = ObserverList()

        self.module_types = (
            (_("Bibles"), biblemgr.bible),
            (_("Commentaries"), biblemgr.commentary),
            (_("Dictionaries"), biblemgr.dictionary),
            (_("Other books"), biblemgr.genbook),
            (_("Daily Devotional"), biblemgr.daily_devotional),
            (_("Harmonies"), biblemgr.harmony),
        )

        self.extra_categories = (
            _("Daily Devotional"),
            _("Maps"),
            _("Images"),
            _("Harmonies"),
        )

        self.all_categories = (
            _("Bibles"),
            _("Commentaries"),
            _("Dictionaries"),
            _("Harmonies"),
            _("Maps"),
            _("Images"),
            _("Daily Devotional"),
            _("Other books"),
        )

        self.on_selection += self.on_version_tree
        self.recreate()
 def __init__(self, passage_list_manager, context):
     self._context = context
     self._passage_list_manager = passage_list_manager
     self._clipboard_data = None
     self._actions = []
     self._undone_actions = []
     self.undo_available_changed_observers = ObserverList()
     self.paste_available_changed_observers = ObserverList()
示例#3
0
 def __init__(self):
     self.sources = []
     self.current_source = None
     self.on_source_added = ObserverList()
     self.on_caption_changed = ObserverList()
     self.on_url_changed = ObserverList()
     self.on_change_item = ObserverList()
     self.on_source_deleted = ObserverList()
示例#4
0
 def __init__(self, parent):
     super(TopicSelector, self).__init__(parent, style=wx.TE_PROCESS_ENTER)
     self._manager = get_primary_passage_list_manager()
     self._dropdown = wx.PopupWindow(self)
     self._setup_list()
     self._selected_topic = None
     self.topic_changed_observers = ObserverList()
     # Called when return is pressed and the drop down is not shown.
     self.return_pressed_observers = ObserverList()
     self._bind_events()
     self.selected_topic = self._manager
示例#5
0
    def __init__(self, passage, comment=""):
        self.passage_changed_observers = ObserverList()
        self.comment_changed_observers = ObserverList()
        self._passage = None
        self._set_passage(passage)
        self._comment = comment
        self.parent = None

        global _passage_entry_id_dict
        _passage_entry_id_dict[self.get_id()] = self
        self.order_number = 0
        self.id = None
示例#6
0
    def __init__(self,
                 biblename="ESV",
                 commentaryname="TSK",
                 dictionaryname="ISBE",
                 genbook="Josephus",
                 daily_devotional_name="",
                 harmonyname="CompositeGospel"):

        self.on_before_reload = ObserverList()
        self.on_after_reload = ObserverList()
        self.reloading = False

        self.mgrs = []
        self.paths = []

        dprint(MESSAGE, "Creating manager")

        self.make_managers()

        # call on after reload in case
        self.on_after_reload(self)

        dprint(MESSAGE, "/Creating manager")

        self.bible = Bible(self, biblename)
        self.commentary = Commentary(self, commentaryname)
        self.dictionary = Dictionary(self, dictionaryname)
        self.genbook = GenBook(self, genbook)
        self.daily_devotional = DailyDevotional(self, daily_devotional_name)
        self.harmony = Harmony(self, harmonyname)

        self.state = []
        self.options = {}
        self.init_options()

        self.book_type_map = {
            self.bible.type: self.bible,
            self.commentary.type: self.commentary,
            self.dictionary.type: self.dictionary,
            self.genbook.type: self.genbook,
        }

        self.book_category_map = {
            self.daily_devotional.category: self.daily_devotional,
            self.harmony.category: self.harmony,
        }

        self.parser_mode = NORMAL_PARSER_MODE
示例#7
0
class DummyMainfrm(object):
    def hide_tooltips(*args, **kwargs):
        pass

    lost_focus = True
    from util.observerlist import ObserverList
    on_close = ObserverList()
示例#8
0
    def __init__(self, parent, keys, position, font=None):
        super(KeyPad, self).__init__(parent, style=wx.NO_BORDER)

        panel = wx.Panel(self, style=wx.RAISED_BORDER)
        if font:
            panel.SetFont(font)

        sizer = wx.GridSizer(
            0,
            #len(keys)/self.COLUMNS,
            self.COLUMNS,
            1,
            1)
        for key in sorted(keys):
            button = wx.Button(panel, label=key, style=wx.BU_EXACTFIT)
            button.SetToolTipString(
                unicodedata.name(key, "<Unknown letter (%r)>" % key))
            sizer.Add(button, 0, wx.GROW)

        panel.SetSizer(sizer)
        o = wx.BoxSizer(wx.HORIZONTAL)
        o.Add(panel, 1, wx.GROW)
        self.SetSizer(o)
        self.Bind(wx.EVT_BUTTON, self.on_button)
        self.Fit()
        self.Layout()
        self.key_pressed = ObserverList()
        self.Position(*position)
示例#9
0
    def __init__(self, parent, model):
        self.model = model
        super(FilterableTree, self).__init__(parent)

        self.bound = False

        self.tree = self.CreateTreeCtrl(
            self,
            style=wx.TR_HAS_BUTTONS | wx.TR_LINES_AT_ROOT | wx.TR_HIDE_ROOT)

        self.search = SearchCtrl(self)

        self.search.SetDescriptiveText(self.blank_text)
        self.search.ShowCancelButton(True)

        self.search.Bind(wx.EVT_KEY_DOWN, self.on_key_down)
        self.search.Bind(wx.EVT_TEXT,
                         lambda evt: self.filter(self.search.Value))
        self.search.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.clear_filter)

        self.on_selection = ObserverList()

        sizer = wx.BoxSizer(wx.VERTICAL)

        if osutils.is_mac():
            sizer.Add(self.search, 0, wx.GROW | wx.ALL, 3)
            sizer.Add(self.tree, 1, wx.GROW | wx.TOP, 6)
        else:
            sizer.Add(self.search, 0, wx.GROW | wx.BOTTOM, 3)
            sizer.Add(self.tree, 1, wx.GROW)

        self.SetSizer(sizer)
        self.expansion_state = None
        self.bind_events()
示例#10
0
    def setup(self):
        self.aui_mgr = aui.AuiManager(
            self, aui.AUI_MGR_ALLOW_FLOATING | aui.AUI_MGR_ALLOW_ACTIVE_PANE
            | aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE
            | aui.AUI_MGR_TRANSPARENT_HINT)

        self.on_close += self.aui_mgr.UnInit

        self.aui_uses_provider = False
        self.maximized_pane_direction = None

        self.needs_showing_event = {}
        self.on_render = ObserverList()

        try:
            self.dockart = DockArt(self)

            self.aui_mgr.Bind(aui.EVT_AUI_RENDER, self.on_aui_render)

            self.aui_mgr.SetArtProvider(self.dockart)
            self.aui_uses_provider = True
        except AttributeError:
            # no constructor defined previous to wx 2.8.4.0, so can't override
            pass

        # now set the inactive caption colour
        # wxAUI arguably should do this itself
        # on high contrast black, you couldn't see the inactive captions at
        # all
        prov = self.aui_mgr.GetArtProvider()

        # wxAUI darkens the gripper colour if it is too light. However, this
        # looks ugly next to a toolbar.
        prov.SetColour(wx.aui.AUI_DOCKART_GRIPPER_COLOUR,
                       wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))

        if not config.use_system_inactive_caption_colour:
            return

        prov.SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE,
                       aui.AUI_GRADIENT_HORIZONTAL)

        inactive_caption_colour = wx.SystemSettings.GetColour(
            wx.SYS_COLOUR_INACTIVECAPTION)

        inactive_caption_gradient_colour = wxAuiLightContrastColour(
            inactive_caption_colour)

        inactive_caption_text_colour = wx.SystemSettings.GetColour(
            wx.SYS_COLOUR_INACTIVECAPTIONTEXT)

        for setting, colour in (
            (aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR, inactive_caption_colour),
            (aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR,
             inactive_caption_gradient_colour),
            (aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
             inactive_caption_text_colour)):

            prov.SetColour(setting, colour)
示例#11
0
	def __init__(self, parent, style=wx.CB_READONLY):
		super(TreeCombo, self).__init__(parent, style=style)

		self.readonly = style & wx.CB_READONLY
		self.on_selected_in_tree = ObserverList()
		
		self.popup = TreeCtrlComboPopup()
		self.popup.SetComboCtrl(self)
		if not osutils.is_msw():
			self.Bind(wx.EVT_KEY_UP, self.on_char)
示例#12
0
    def __init__(self, parent, event, rect, book, key, style=wx.NO_BORDER):
        super(ModulePopup, self).__init__(parent, style)

        panel = wx.Panel(self)  #, style=wx.RAISED_BORDER, pos=(0, 0))

        self.box = PopupList(panel, book, key)
        #wx.ListBox(
        #	panel, style=wx.LB_SINGLE|wx.LB_HSCROLL|wx.NO_BORDER,
        #	pos=(0, 0)
        #)

        self.box.Bind(wx.EVT_LEFT_DOWN, self.ProcessLeftDown)
        self.box.Bind(wx.EVT_LEFT_UP, self.ProcessLeftDown)
        self.box.Bind(wx.EVT_MOTION, self.OnMotion)

        #self.box.Items = book.GetModuleList()
        #if book.version:
        #	self.box.SetStringSelection(book.version)
        #I:\python\bpbible\gui\virtuallist.py:46: RuntimeWarning: tp_compare didn't retur
        #n -1 or -2 for exception

        s = [400, 300]  #self.box.GetBestSize() + (250, 200)

        # don't display empty whitespace at the end of the list unless needed
        bottom = self.box.GetItemRect(self.box.ItemCount - 1).Bottom + 1
        if osutils.is_msw():
            bottom += 4

        if bottom < s[1]:
            s[1] = bottom

        self.box.Size = s

        panel.ClientSize = self.box.Size
        size_combo = 0

        # Show the popup right below or above the button
        # depending on available screen space...
        btn = event.EventObject

        self.SetSize(panel.GetSize())  # - (0, size_combo)
        pos = btn.ClientToScreen(rect.TopRight)
        self.Position(pos, (-rect.Width, rect.Height))

        self.on_dismiss = ObserverList()
示例#13
0
    def __init__(self, parent, i_current_chapter, style=wx.NO_BORDER):
        super(HeaderBar, self).__init__(parent, style=style)

        self.i_current_chapter = i_current_chapter
        self.Bind(wx.EVT_SIZE, self.on_size)
        self.on_click = ObserverList()

        # if we are at either end of the Bible, this line fills in the rest of
        # the bottom line.
        self.line = Line(self)

        self.create_item()

        self.MinSize = -1, self.item.Size[1] + 1

        if guiconfig.mainfrm:
            guiconfig.mainfrm.add_toplevel(self.tooltip)

        self.items = [[], []]
示例#14
0
    def __init__(self, description=""):
        self._description = description
        self.parent = None
        self.name_changed_observers = ObserverList()
        self.description_changed_observers = ObserverList()
        self.order_passages_by_observers = ObserverList()
        self.subtopics = []
        self._name = ""
        self.add_subtopic_observers = ObserverList()
        self.remove_subtopic_observers = ObserverList()

        global _passage_list_id_dict
        _passage_list_id_dict[self.get_id()] = self

        self._natural_order_passages = []
        self._passage_order_passages = None
        self.add_passage_observers = ObserverList()
        self.remove_passage_observers = ObserverList()
        self.passage_order_changed_observers = ObserverList()
        self.id = None
        self.order_number = 0
        self._order_passages_by = "NATURAL_ORDER"
示例#15
0
    def __init__(self, parent, book):
        super(DictionarySelector, self).__init__(parent)
        self.text_entry = TextEntry(self)
        self.list = DictionaryList(self, book)
        self.set_book(book)
        self.timer = wx.Timer(self)
        self.item_to_focus_on = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.text_entry, 0, wx.GROW)
        sizer.Add(self.list, 1, wx.GROW)
        self.text_entry.text.Bind(wx.EVT_TEXT, self.on_text)
        self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_list)
        self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
        width = 200

        self.SetSizerAndFit(sizer)
        self.item_changed_observers = ObserverList()
        fonts.fonts_changed += self.set_font
        guiconfig.mainfrm.on_close += lambda:\
         fonts.fonts_changed.remove(self.set_font)
示例#16
0

def get_module_gui_font(module, default_to_None=False):
    default, (face, size, use_in_gui) = get_module_font_params(module)
    if use_in_gui:
        font = wx.FFont(size, wx.FONTFAMILY_ROMAN, face=face)
    else:
        if default_to_None:
            font = None
        else:
            font = wx.NORMAL_FONT

    return font  #use_in_gui, font


fonts_changed = ObserverList()

font_css = ""
css_loaded = False


def fonts_have_changed():
    global css_loaded
    css_loaded = False


fonts_changed += fonts_have_changed


def get_css():
    global font_css, css_loaded
示例#17
0
		("", N_("Strongs Numbers")),
	], options_section=filter_settings,
		reload_options=RELOAD_BIBLE_FRAMES,
		on_option_selected=on_headwords_module_changed,
	),
	BooleanOptionMenuItem("highlight_strongs", N_("Highlight Matching Strongs")),
	BooleanOptionMenuItem("morphology", N_("Morphology"), reload_options=RELOAD_BIBLE_FRAMES),
	BooleanOptionMenuItem("morph_segmentation", N_("Morph Segmentation"), reload_options=RELOAD_BIBLE_FRAMES),
]

debug_options_menu = [
	BooleanOptionMenuItem("raw", N_("Output Raw"), reload_options=RELOAD_ALL_FRAMES),
	BooleanOptionMenuItem("show_timing", N_("Display timing")),
]

display_option_changed_observers = ObserverList()

def display_option_changed(option_name, reload_options, options_section):
	from backend.bibleinterface import biblemgr
	if option_name in sword_options_map:
		biblemgr.set_option(sword_options_map[option_name], options_section[option_name])

	display_option_changed_observers(option_name, options_section)
	if reload_options == RELOAD_BIBLE_FRAMES:
		guiconfig.mainfrm.UpdateBibleUI(settings_changed=True, source=events.SETTINGS_CHANGED)
	elif reload_options == RELOAD_ALL_FRAMES:
		guiconfig.mainfrm.refresh_all_pages()

def all_options():
	return options.items.keys()
示例#18
0
 def __init__(self):
     self.history = HistoryItem(None, None)
     self.current_item = self.history
     self.on_history_changed = ObserverList()
示例#19
0
 def __init__(self, parent):
     self.aui_dock_art = wx.aui.AuiDefaultDockArt()
     self.caption_drawn = ObserverList()
     super(DockArt, self).__init__()
     self.parent = parent
示例#20
0
    def __init__(self,
                 parent,
                 text,
                 position,
                 look=0,
                 colour=0,
                 parent_look=0,
                 parent_colour=0,
                 using_parent=True):
        super(LookPicker, self).__init__(parent, style=wx.NO_BORDER)
        self.look = look
        self.colour = colour
        self.parent_look = parent_look
        self.parent_colour = parent_colour
        self.using_parent_look = using_parent

        panel = wx.Panel(self, style=wx.RAISED_BORDER)
        main_sizer = wx.FlexGridSizer(6, 1, 3, 6)
        use_parent_look_label = wx.StaticText(panel,
                                              label=_("Use Parent Look:"))
        colour_label = wx.StaticText(panel, label=_("Colour:"))
        label_font = use_parent_look_label.Font
        label_font.Weight = wx.FONTWEIGHT_BOLD
        colour_label.Font = use_parent_look_label.Font = label_font

        # Use parent look.
        use_parent_look_tag_border = Border(panel)
        use_parent_look_tag = PassageTagLook(use_parent_look_tag_border,
                                             text,
                                             look=self.parent_look,
                                             colour=self.parent_colour)
        use_parent_look_tag_border.set_child(use_parent_look_tag)
        self.parent = use_parent_look_tag

        use_parent_look_tag.Bind(wx.EVT_LEFT_UP, self.on_select_parent_look)

        # Choose colour.
        self.colours = []
        colour_sizer = wx.GridSizer(
            len(rectangle_colours_and_looks) / self.COLUMNS, self.COLUMNS, 0,
            0)
        for colour_index, look_index in rectangle_colours_and_looks:
            colour_rect_border = Border(panel,
                                        border_width=4,
                                        rounded_rectangle_radius=3)
            colour_rect = ColourRect(colour_rect_border,
                                     look=look_index,
                                     colour=colour_index)
            colour_rect_border.set_child(colour_rect)
            self.colours.append(colour_rect)
            colour_sizer.Add(colour_rect_border, 0, wx.ALIGN_CENTRE)

            colour_rect.Bind(wx.EVT_LEFT_UP, self.on_select_colour)

        def AddItemWithPadding(item, padding):
            new_sizer = wx.BoxSizer(wx.HORIZONTAL)
            new_sizer.AddSpacer(padding)
            new_sizer.Add(item)
            new_sizer.AddSpacer(padding)
            main_sizer.Add(new_sizer)

        main_sizer.Add(use_parent_look_label, 0, wx.CENTRE)
        AddItemWithPadding(use_parent_look_tag_border, 5)
        main_sizer.Add(colour_label)
        AddItemWithPadding(colour_sizer, 5)

        self.update_borders()

        panel.SetSizer(main_sizer)
        o = wx.BoxSizer(wx.HORIZONTAL)
        o.Add(panel, 1, wx.GROW)
        self.SetSizer(o)
        self.Fit()
        self.Layout()
        self.look_updated = ObserverList()
        self.Position(*position)
示例#21
0
 def __init__(self):
     self._map = {}
     self.add_verses_observers = ObserverList()
     self.remove_verses_observers = ObserverList()
     self.disable_observers = False
示例#22
0
 def setup(self):
     self.observers = ObserverList()
     super(BibleFrame, self).setup()