예제 #1
0
    def __init__(self, session_bus):
        Gtk.Window.__init__(self, type=Gtk.WindowType.POPUP)
        self.set_resizable(False)
        self.set_border_width(2)
        self.set_size_request(100, -1)

        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.add(hbox)

        handle = Handle()
        hbox.pack_start(handle, False, False, 0)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=3)
        hbox.pack_start(vbox, True, True, 6)

        preedit_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
                               spacing=6)
        preedit_hbox.connect('size-allocate', self.on_preedit_hbox_allocate)
        vbox.pack_start(preedit_hbox, True, True, 0)

        self._preedit_label = Gtk.Label()
        self._preedit_label.set_alignment(0, 0.5)
        preedit_hbox.pack_start(self._preedit_label, True, True, 0)

        self._lookup_separator = Gtk.Separator(
            orientation=Gtk.Orientation.VERTICAL)
        preedit_hbox.pack_start(self._lookup_separator, False, False, 0)

        self.look_forward_button = self._create_arrow_button(
            Gtk.STOCK_GO_FORWARD)
        self.look_forward_button.connect('clicked', self.on_lookup_forward)
        preedit_hbox.pack_end(self.look_forward_button, False, False, 0)

        self.look_back_button = self._create_arrow_button(Gtk.STOCK_GO_BACK)
        self.look_back_button.connect('clicked', self.on_lookup_back)
        preedit_hbox.pack_end(self.look_back_button, False, False, 0)

        self._separator = Gtk.Separator()
        vbox.pack_start(self._separator, False, False, 0)

        self._aux_label = Gtk.Label()
        self._aux_label.set_alignment(0, 0.5)
        vbox.pack_start(self._aux_label, True, True, 0)

        self._lookup_label = Gtk.Label()
        self._lookup_label.set_alignment(0, 0.5)
        vbox.pack_start(self._lookup_label, True, True, 0)

        self._show_preedit = False
        self._show_lookup = False
        self._show_aux = False

        self._cursor_x = 0
        self._cursor_y = 0
        self._cursor_h = 0
        self._showing_popup = False
        self.non_im_items_index = 0

        self._controller = GimPanelController(session_bus, self)

        self.setup_indicator()

        self.langpanel = LangPanel(self._controller)
        self.langpanel.show_all()
        self.langpanel.hide()
        self.langpanel.connect('popup_menu', self.show_popup_menu)

        self.connect('destroy', self.on_gimpanel_exit)
        self.connect("size-allocate", lambda w, a: self._move_position())
        self.connect('realize', self.on_realize)
예제 #2
0
 def setUp(self):
     self.langpanel = LangPanel()