Esempio n. 1
0
	def new_translate_page(self, event=None):
		""" Добавляет новую вкладку с окном перевода
		"""
		label = gtk.Label()
		tv = TransView(label)
		self.notebook.append_page(tv)
		header = ghlp.create_tab_header(label, tv, self.on_close_tab_clicked)
		self.notebook.set_tab_label(tv, header)
		tv.show()
		self.notebook.next_page()
Esempio n. 2
0
    def new_translate_page(self, event=None):
        """ Добавляет новую вкладку с окном перевода
		"""
        label = gtk.Label()
        tv = TransView(label)
        self.notebook.append_page(tv)
        header = ghlp.create_tab_header(label, tv, self.on_close_tab_clicked)
        self.notebook.set_tab_label(tv, header)
        tv.show()
        self.notebook.next_page()
Esempio n. 3
0
File: spy.py Progetto: mdevaev/slog
class SpyView(gtk.Window):
	def __init__(self):
		gtk.Window.__init__(self, gtk.WINDOW_POPUP)

		self.set_app_paintable(True)
		self.set_resizable(False)
		self.set_size_request(320, 240)
		self.set_name("gtk-tooltips")
		self.connect("expose_event", self.__on_expose_event)

		self.__tv = TransView()
		self.add(self.__tv)
		self.__tv.show()

	def __on_expose_event(self, window, event):
		w, h = window.size_request()
		window.style.paint_flat_box(window.window, gtk.STATE_NORMAL, gtk.SHADOW_OUT,
									None, window, "tooltip", 0, 0, w, h)
		return False

	def __get_pos(self):
		display = gdk.display_get_default()
		screen, x, y, mask = display.get_pointer()
		w = screen.get_width()
		h = screen.get_height()

		if (x + 320 + 5) > w:
			x = (w - 320 - 8)

		if (y + 240 + 5) > h:
			y = (y - 240 - 2)

		return (x+8), (y+2)

	def set_url_callback(self, callback):
		self.__tv.document.connect("link-clicked", callback)
		pass

	def set_translate(self, word, translate):
		self.__tv.set_translate(word, translate)

	def popup(self):
		x, y = self.__get_pos()
		self.move(x, y)
		self.show()
Esempio n. 4
0
class SpyView(gtk.Window):
	def __init__(self):
		gtk.Window.__init__(self, gtk.WINDOW_POPUP)

		self.set_app_paintable(True)
		self.set_resizable(False)
		self.set_size_request(320, 240)
		self.set_name("gtk-tooltips")
		self.connect("expose_event", self.__on_expose_event)

		self.__tv = TransView()
		self.add(self.__tv)
		self.__tv.show()

	def __on_expose_event(self, window, event):
		w, h = window.size_request()
		window.style.paint_flat_box(window.window, gtk.STATE_NORMAL, gtk.SHADOW_OUT,
									None, window, "tooltip", 0, 0, w, h)
		return False

	def __get_pos(self):
		display = gdk.display_get_default()
		screen, x, y, mask = display.get_pointer()
		w = screen.get_width()
		h = screen.get_height()

		if (x + 320 + 5) > w:
			x = (w - 320 - 8)

		if (y + 240 + 5) > h:
			y = (y - 240 - 2)

		return (x+8), (y+2)

	def set_url_callback(self, callback):
		self.__tv.htmlview.connect("url-clicked", callback)

	def set_translate(self, word, translate):
		self.__tv.set_translate(word, translate)

	def popup(self):
		x, y = self.__get_pos()
		self.move(x, y)
		self.show()