Exemple #1
0
    def __init__(self):
        Gtk.Box.__init__(self)

        paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)

        scrolled_window = Gtk.ScrolledWindow.new(None, None)
        scrolled_window.set_policy(Gtk.PolicyType.NEVER,
                                   Gtk.PolicyType.AUTOMATIC)

        self.view = Gucharmap.ChaptersView()
        self.view.set_headers_visible(False)

        model = Gucharmap.ScriptChaptersModel.new()
        self.view.set_model(model)

        selection = self.view.get_selection()
        selection.connect("changed", self.on_chapter_view_selection_changed)

        scrolled_window.add(self.view)
        paned.pack1(scrolled_window, False, True)

        scrolled_window = Gtk.ScrolledWindow.new(None, None)
        scrolled_window.set_policy(Gtk.PolicyType.NEVER,
                                   Gtk.PolicyType.AUTOMATIC)

        self.chartable = Gucharmap.Chartable()

        scrolled_window.add(self.chartable)
        paned.pack2(scrolled_window, True, True)

        paned.set_position(150)
        paned.show_all()

        self.pack_start(paned, True, True, 0)
Exemple #2
0
 def on_chapter_view_selection_changed(self, selection):
     model, it = selection.get_selected()
     if it:
         script_name = self.view.get_selected()
         codepoint_list = Gucharmap.ScriptCodepointList()
         codepoint_list.append_script(script_name)
         self.chartable.set_codepoint_list(codepoint_list)
Exemple #3
0
    def on_table_sync_active_char(self, chartable, pspec):
        uc = chartable.get_active_character()
        text = "%s %s" % (uc, Gucharmap.get_unicode_name(uc))

        a = Gucharmap.get_nameslist_equals(uc)
        if a:
            text += "   = %s" % a[0]
            for i in range(len (a) - 1):
                text += "; %s" % a[i + 1]

        a = Gucharmap.get_nameslist_stars(uc)
        if a:
            text += "   \342\200\242 %s" % a[0]
            for i in range(len (a) - 1):
                text += "; %s" % a[i + 1]

        self.on_table_status_message(chartable, text)
Exemple #4
0
    def on_table_sync_active_char(self, chartable, pspec):
        uc = chartable.get_active_character()
        text = "%s %s" % (uc, Gucharmap.get_unicode_name(uc))

        a = Gucharmap.get_nameslist_equals(uc)
        if a:
            text += "   = %s" % a[0]
            for i in range(len(a) - 1):
                text += "; %s" % a[i + 1]

        a = Gucharmap.get_nameslist_stars(uc)
        if a:
            text += "   \342\200\242 %s" % a[0]
            for i in range(len(a) - 1):
                text += "; %s" % a[i + 1]

        self.on_table_status_message(chartable, text)
Exemple #5
0
    def on_table_activate(self, chartable):
        uc = chartable.get_active_character()
        if not Gucharmap.unichar_validate(uc):
            raise ValueError

        view = self.window.get_active_view()
        if not view or not view.get_editable():
            return

        document = view.get_buffer()

        document.begin_user_action()
        iters = document.get_selection_bounds()
        if iters:
            document.delete_interactive(iters[0], iters[1], view.get_editable())

        document.insert_interactive_at_cursor(uc, -1, view.get_editable())

        document.end_user_action()
Exemple #6
0
    def on_table_activate(self, chartable):
        uc = chartable.get_active_character()
        if not Gucharmap.unichar_validate(uc):
            raise ValueError

        view = self.window.get_active_view()
        if not view or not view.get_editable():
            return

        document = view.get_buffer()

        document.begin_user_action()
        iters = document.get_selection_bounds()
        if iters:
            document.delete_interactive(iters[0], iters[1],
                                        view.get_editable())

        document.insert_interactive_at_cursor(uc, -1, view.get_editable())

        document.end_user_action()