Remove Tooltips because it is deprecated in PyGTK 2.12 and above

This commit is contained in:
Cédric Krier committed 2009-04-09 12:14:31 +02:00
1 parent 4d0ce9f760
commit 7cc500ff92
19 files changed
+63 -38

No files matched your search

+19
View File
@@ -992,6 +992,25 @@ class RPCProgress(object):
raise self.exception
return self.res
class Tooltips(object):
_tooltips = None
def set_tip(self, widget, tip_text):
if hasattr(widget, 'set_tooltip_text'):
return widget.set_tooltip_text(tip_text)
if not self._tooltips:
self._tooltips = gtk.Tooltips()
return self._tooltips.set_tip(widget, tip_text)
def enable(self):
if self._tooltips:
self._tooltips.enable()
def disable(self):
if self._tooltips:
self._tooltips.disable()
COLOR_SCHEMES = {
'red': '#cf1d1d',
'green': '#3fb41b',
+1 -1
View File
@@ -90,7 +90,7 @@ class Main(object):
if hasattr(gtk, 'accel_map_load'):
gtk.accel_map_load(os.path.join(get_home_dir(), '.trytonsc'))
self.tooltips = gtk.Tooltips()
self.tooltips = common.Tooltips()
toolbar = gtk.Toolbar()
self.toolbar = toolbar
+10 -10
View File
@@ -30,7 +30,7 @@ class DBCreate(object):
self.tooltips.set_tip(self.entry_server_connection,_("This is the URL of " \
"the Tryton server. Use server 'localhost' and port '8070' if " \
"the server is installed on this computer. Click on 'Change' to " \
"change the address."), None)
"change the address."))
else:
self.entry_serverpasswd.set_sensitive(False)
self.entry_dbname.set_sensitive(False)
@@ -50,7 +50,7 @@ class DBCreate(object):
"3. If there is a firewall between the server and this " \
"client, make shure that the server address and port " \
"(usually 8070) are not blocked.\n" \
"Click on 'Change' to change the address."), None)
"Click on 'Change' to change the address."))
return state
def server_change(self, widget, parent):
@@ -142,7 +142,7 @@ class DBCreate(object):
self.dialog.set_icon(TRYTON_ICON)
# This event is needed for controlling the button_create
self.dialog.connect("key-press-event", self.event_show_button_create)
self.tooltips = gtk.Tooltips()
self.tooltips = common.Tooltips()
self.dialog.add_button("gtk-cancel", \
gtk.RESPONSE_CANCEL)
self.button_create = gtk.Button(_('C_reate'))
@@ -181,7 +181,7 @@ class DBCreate(object):
self.tooltips.set_tip(self.entry_server_connection, _("This is the URL of " \
"the server. Use server 'localhost' and port '8070' if " \
"the server is installed on this computer. Click on 'Change' to " \
"change the address."), None)
"change the address."))
self.button_server_change = gtk.Button(_("C_hange"), stock=None,
use_underline=True)
img_button_server_change = gtk.Image()
@@ -190,7 +190,7 @@ class DBCreate(object):
self.button_server_change.set_image(img_button_server_change)
table.attach(self.button_server_change, 2, 3, 1, 2, yoptions=False, xoptions=gtk.FILL)
self.tooltips.set_tip(self.button_server_change, _("Setup the " \
"server connection..."), None)
"server connection..."))
label_serverpasswd = gtk.Label(_("Tryton Server Password:"))
label_serverpasswd.set_justify(gtk.JUSTIFY_RIGHT)
label_serverpasswd.set_alignment(1, 0.5)
@@ -203,7 +203,7 @@ class DBCreate(object):
self.tooltips.set_tip(self.entry_serverpasswd, _("This is the " \
"password of the Tryton server. It doesn't belong to a " \
"real user. This password is usually defined in the trytond " \
"configuration."), None)
"configuration."))
self.entry_serverpasswd.connect("key-press-event", \
self.event_passwd_clear)
@@ -230,7 +230,7 @@ class DBCreate(object):
"database.\n" \
"Allowed characters are alphanumerical or _ (underscore)\n" \
"You need to avoid all accents, space or special characters! " \
"Example: tryton"), None)
"Example: tryton"))
handlerid = self.entry_dbname.connect("insert-text", \
self.entry_insert_text)
self.entry_dbname.set_data('handlerid', handlerid)
@@ -246,7 +246,7 @@ class DBCreate(object):
self.tooltips.set_tip(eventbox_language, _("Choose the default " \
"language that will be installed for this database. You will " \
"be able to install new languages after installation through " \
"the administration menu."), None)
"the administration menu."))
label_adminpasswd = gtk.Label(_("Admin password:"))
label_adminpasswd.set_justify(gtk.JUSTIFY_RIGHT)
label_adminpasswd.set_padding( 3, 3)
@@ -259,7 +259,7 @@ class DBCreate(object):
"the admin user of the new database. With these credentials you " \
"will be later able to login into the database:\n" \
"User name: admin\n" \
"Password: <The password you set here>"), None)
"Password: <The password you set here>"))
table.attach(self.entry_adminpasswd, 1, 3, 7, 8)
self.entry_adminpasswd.connect("key-press-event", \
self.event_passwd_clear)
@@ -272,7 +272,7 @@ class DBCreate(object):
self.entry_adminpasswd2.set_visibility(False)
self.entry_adminpasswd2.set_activates_default(True)
self.tooltips.set_tip(self.entry_adminpasswd2, _("Type the Admin " \
"password again"), None)
"password again"))
table.attach(self.entry_adminpasswd2, 1, 3, 8, 9)
self.entry_adminpasswd2.connect("key-press-event", \
self.event_passwd_clear)
+3 -3
View File
@@ -89,7 +89,7 @@ class DBBackupDrop(object):
self.dialog.set_has_separator(True)
self.dialog.set_icon(TRYTON_ICON)
self.dialog.connect("key-press-event", self.event_show_button_ok)
self.tooltips = gtk.Tooltips()
self.tooltips = common.Tooltips()
self.dialog.add_button("gtk-cancel", \
gtk.RESPONSE_CANCEL)
self.button_ok = gtk.Button(button_ok_text)
@@ -133,7 +133,7 @@ class DBBackupDrop(object):
self.tooltips.set_tip(self.entry_server_connection, _("This is the " \
"URL of the server. Use server 'localhost' and port '8070' " \
"if the server is installed on this computer. " \
"Click on 'Change' to change the address."), None)
"Click on 'Change' to change the address."))
table.attach(self.entry_server_connection, 1, 2, 2, 3)
self.button_server_change = gtk.Button(_("C_hange"), stock=None, \
@@ -172,7 +172,7 @@ class DBBackupDrop(object):
self.tooltips.set_tip(self.entry_serverpasswd, _("This is the " \
"password of the Tryton server. It doesn't belong to a " \
"real user. This password is usually defined in the trytond " \
"configuration."), None)
"configuration."))
table.attach(self.entry_serverpasswd, 1, 3, 4, 5)
self.entry_serverpasswd.grab_focus()
+1 -1
View File
@@ -19,7 +19,7 @@ class DBLogin(object):
self.dialog.set_has_separator(True)
self.dialog.set_icon(TRYTON_ICON)
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
button_cancel = gtk.Button(_('_Cancel'))
img_cancel = gtk.Image()
img_cancel.set_from_stock('tryton-cancel', gtk.ICON_SIZE_BUTTON)
+5 -5
View File
@@ -69,7 +69,7 @@ class DBRestore(object):
| gtk.WIN_POS_CENTER_ON_PARENT)
vbox = gtk.VBox()
self.dialog.vbox.pack_start(vbox)
self.tooltips = gtk.Tooltips()
self.tooltips = common.Tooltips()
table = gtk.Table(5, 3, False)
table.set_border_width(9)
table.set_row_spacings(3)
@@ -90,7 +90,7 @@ class DBRestore(object):
self.tooltips.set_tip(self.entry_server_url, _("This is the URL of " \
"the server. Use server 'localhost' and port '8070' if " \
"the server is installed on this computer. Click on " \
"'Change' to change the address."), None)
"'Change' to change the address."))
table.attach(self.entry_server_url, 1, 2, 0, 1)
self.button_server_change = gtk.Button(_("C_hange"), stock=None, \
use_underline=True)
@@ -99,7 +99,7 @@ class DBRestore(object):
'tryton-preferences-system', gtk.ICON_SIZE_BUTTON)
self.button_server_change.set_image(img_button_server_change)
self.tooltips.set_tip(self.button_server_change, _("Setup the " \
"server connection..."), None)
"server connection..."))
table.attach(self.button_server_change, 2, 3, 0, 1)
label_server_password = gtk.Label(_("Tryton Server Password:"))
label_server_password.set_justify(gtk.JUSTIFY_RIGHT)
@@ -113,7 +113,7 @@ class DBRestore(object):
self.tooltips.set_tip(self.entry_server_password, _("This is the " \
"password of the Tryton server. It doesn't belong to a " \
"real user. This password is usually defined in the trytond " \
"configuration."), None)
"configuration."))
table.attach(self.entry_server_password, 1, 3, 1, 2)
hseparator = gtk.HSeparator()
table.attach(hseparator, 0, 3, 2, 3)
@@ -136,7 +136,7 @@ class DBRestore(object):
"the database to be restored.\n" \
"Allowed characters are alphanumerical or _ (underscore)\n" \
"You need to avoid all accents, space or special " \
"characters! \nExample: tryton"), None)
"characters! \nExample: tryton"))
table.attach(self.entry_db_name, 1, 3, 4, 5)
label_db_name = gtk.Label(_("New Database Name:"))
label_db_name.set_alignment(1, 0.5)
+1 -1
View File
@@ -61,7 +61,7 @@ class Action(object):
self.title = gtk.Label()
hbox.pack_start(self.title, expand=True, fill=True)
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)
+1 -1
View File
@@ -18,7 +18,7 @@ class ParserBoard(object):
attrs = common.node_attributes(root_node)
if not tooltips:
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
container = _container(tooltips)
container.new(col=int(attrs.get('col', 4)))
@@ -3,7 +3,7 @@ import base64
import gtk
import gettext
import os
from tryton.common import file_selection, message, warning
from tryton.common import file_selection, message, warning, Tooltips
from interface import WidgetInterface
_ = gettext.gettext
@@ -15,7 +15,7 @@ class Binary(WidgetInterface):
def __init__(self, window, parent, model, attrs=None):
super(Binary, self).__init__(window, parent, model, attrs)
self.tooltips = gtk.Tooltips()
self.tooltips = Tooltips()
self.widget = gtk.HBox(spacing=0)
self.wid_text = gtk.Entry()
@@ -8,7 +8,7 @@ from interface import WidgetInterface
import tryton.rpc as rpc
from tryton.common import DT_FORMAT, DHM_FORMAT, HM_FORMAT, message, \
TRYTON_ICON
from tryton.common import date_widget
from tryton.common import date_widget, Tooltips
from tryton.translate import date_format
import mx.DateTime
@@ -41,7 +41,7 @@ class Calendar(WidgetInterface):
self.widget.pack_start(self.but_open, expand=False, fill=False)
self.widget.set_focus_chain([self.entry])
tooltips = gtk.Tooltips()
tooltips = Tooltips()
tooltips.set_tip(self.but_open, _('Open the calendar'))
tooltips.enable()
@@ -176,7 +176,7 @@ class DateTime(WidgetInterface):
self.widget.pack_start(self.but_open, expand=False, fill=False)
self.widget.set_focus_chain([self.entry])
tooltips = gtk.Tooltips()
tooltips = Tooltips()
tooltips.set_tip(self.but_open, _('Open the calendar'))
tooltips.enable()
@@ -3,7 +3,7 @@ import gtk
import gettext
import os
from base64 import encodestring, decodestring
from tryton.common import file_selection
from tryton.common import file_selection, Tooltips
from tryton.config import PIXMAPS_DIR
from interface import WidgetInterface
import urllib
@@ -30,7 +30,7 @@ class Image(WidgetInterface):
self.event.connect('drag_motion', self.drag_motion)
self.event.connect('drag_data_received', self.drag_data_received)
self.tooltips = gtk.Tooltips()
self.tooltips = Tooltips()
self.image = gtk.Image()
self.event.add(self.image)
@@ -195,7 +195,7 @@ class Many2One(WidgetInterface):
self.widget.set_focus_chain([self.wid_text])
self.tooltips = gtk.Tooltips()
self.tooltips = common.Tooltips()
self.tooltips.set_tip(self.but_new, _('Create a new record'))
self.tooltips.set_tip(self.but_open, _('Open a record'))
self.tooltips.enable()
@@ -38,7 +38,7 @@ def _create_menu(self, attrs):
menubar.add(menuitem_title)
hbox.pack_start(menubar, expand=True, fill=True)
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
if attrs.get('add_remove'):
@@ -410,7 +410,7 @@ class ParserForm(ParserInterface):
attrs = common.node_attributes(root_node)
on_write = attrs.get('on_write', '')
if not tooltips:
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
container = _container(tooltips)
if CONFIG['client.modepda']:
container.new(col=1)
@@ -68,7 +68,7 @@ class Reference(WidgetInterface):
self.widget.set_focus_chain([self.widget_combo, self.wid_text])
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
tooltips.set_tip(self.but_open, _('Search / Open a record'))
tooltips.set_tip(self.but_new, _('Create a new record'))
tooltips.enable()
@@ -3,6 +3,7 @@ import gettext
import gtk
from char import Char
import webbrowser
import tryton.common as common
class URL(Char):
@@ -13,7 +14,7 @@ class URL(Char):
attrs = {}
super(URL, self).__init__(window, parent, model, attrs=attrs)
self.tooltips = gtk.Tooltips()
self.tooltips = common.Tooltips()
self.button = gtk.Button()
img = gtk.Image()
img.set_from_stock('tryton-web-browser', gtk.ICON_SIZE_SMALL_TOOLBAR)
@@ -34,6 +35,7 @@ class URL(Char):
self.tooltips.enable()
self.tooltips.set_tip(self.button, value)
else:
self.tooltips.set_tip(self.button, '')
self.tooltips.disable()
def _readonly_set(self, value):
@@ -65,6 +67,7 @@ class Email(URL):
self.tooltips.enable()
self.tooltips.set_tip(self.button, 'mailto:%s' % value)
else:
self.tooltips.set_tip(self.button, '')
self.tooltips.disable()
@@ -82,6 +85,7 @@ class CallTo(URL):
self.tooltips.enable()
self.tooltips.set_tip(self.button, 'callto:%s' % value)
else:
self.tooltips.set_tip(self.button, '')
self.tooltips.disable()
@@ -99,5 +103,6 @@ class SIP(URL):
self.tooltips.enable()
self.tooltips.set_tip(self.button, 'sip:%s' % value)
else:
self.tooltips.set_tip(self.button, '')
self.tooltips.disable()
@@ -90,7 +90,7 @@ class ParserTree(ParserInterface):
treeview.set_property('rules-hint', True)
if not self.title:
self.title = attrs.get('string', 'Unknown')
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
for node in root_node.childNodes:
node_attrs = node_attributes(node)
@@ -1,6 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
import gtk
import gettext
import tryton.common as common
_ = gettext.gettext
@@ -18,7 +19,7 @@ class ScreenContainer(object):
return self.vbox
def add_filter(self, widget, fnct, clear_fnct):
tooltips = gtk.Tooltips()
tooltips = common.Tooltips()
self.filter_vbox = gtk.VBox(spacing=0)
self.filter_vbox.set_border_width(0)
@@ -6,7 +6,7 @@ import gettext
import locale
from interface import Interface
from tryton.common import DT_FORMAT, TRYTON_ICON
from tryton.common import date_widget
from tryton.common import date_widget, Tooltips
from tryton.translate import date_format
import mx.DateTime
import gobject
@@ -20,7 +20,7 @@ class Calendar(Interface):
super(Calendar, self).__init__(name, parent, attrs=attrs,
context=context)
tooltips = gtk.Tooltips()
tooltips = Tooltips()
self.widget = gtk.HBox(spacing=3)
self.format = date_format()