Revert r10548, and disable changing the family tree name by button press.

svn: r10549
This commit is contained in:
Zsolt Foldvari 2008-04-11 13:12:11 +00:00
parent 48876977c8
commit 1bc022b584

View File

@ -53,7 +53,6 @@ else:
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gobject
import gtk import gtk
from gtk import glade from gtk import glade
from gtk.gdk import ACTION_COPY from gtk.gdk import ACTION_COPY
@ -100,8 +99,6 @@ STOCK_COL = 6
RCS_BUTTON = { True : _('Extract'), False : _('Archive') } RCS_BUTTON = { True : _('Extract'), False : _('Archive') }
DOUBLE_CLICK_TIMEOUT = gtk.settings_get_default().get_property('gtk-double-click-time') + 100
class CLIDbManager: class CLIDbManager:
""" """
Database manager without GTK functionality, allows users to create and Database manager without GTK functionality, allows users to create and
@ -305,10 +302,7 @@ class DbManager(CLIDbManager):
self.__connect_signals() self.__connect_signals()
self.__build_interface() self.__build_interface()
self._populate_model() self._populate_model()
self.timer_on = False
self.selection_changed = False
def __connect_signals(self): def __connect_signals(self):
""" """
Connects the signals to the buttons on the interface. Connects the signals to the buttons on the interface.
@ -336,35 +330,12 @@ class DbManager(CLIDbManager):
treat a double click as if it was OK button press. However, we have treat a double click as if it was OK button press. However, we have
to make sure that an item was selected first. to make sure that an item was selected first.
""" """
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
if not self.timer_on:
new_event = event.copy()
gobject.timeout_add(DOUBLE_CLICK_TIMEOUT,
self.__really_single_button_press,
new_event)
self.timer_on = True
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.timer_on = False
if self.connect.get_property('sensitive'): if self.connect.get_property('sensitive'):
self.top.response(gtk.RESPONSE_OK) self.top.response(gtk.RESPONSE_OK)
return True return True
return False return False
def __really_single_button_press(self, event):
if self.timer_on:
if not self.selection_changed:
self.name_renderer.set_property('editable', True)
self.dblist.emit('button-press-event', event)
self.name_renderer.set_property('editable', False)
self.timer_on = False
self.selection_changed = False
return False
def __key_press(self, obj, event): def __key_press(self, obj, event):
""" """
Grab ENTER so it does not start editing the cell, but behaves Grab ENTER so it does not start editing the cell, but behaves
@ -378,8 +349,9 @@ class DbManager(CLIDbManager):
return False return False
def __selection_changed(self, selection): def __selection_changed(self, selection):
"""Called when the selection is changed in the TreeView.""" """
self.selection_changed = True Called when the selection is changed in the TreeView.
"""
self.__update_buttons(selection) self.__update_buttons(selection)
def __update_buttons(self, selection): def __update_buttons(self, selection):
@ -447,7 +419,6 @@ class DbManager(CLIDbManager):
# build the database name column # build the database name column
render = gtk.CellRendererText() render = gtk.CellRendererText()
#render.set_property('editable', True)
render.set_property('ellipsize', pango.ELLIPSIZE_END) render.set_property('ellipsize', pango.ELLIPSIZE_END)
render.connect('edited', self.__change_name) render.connect('edited', self.__change_name)
render.connect('editing-canceled', self.__stop_edit) render.connect('editing-canceled', self.__stop_edit)
@ -458,8 +429,7 @@ class DbManager(CLIDbManager):
self.column.set_resizable(True) self.column.set_resizable(True)
self.column.set_min_width(275) self.column.set_min_width(275)
self.dblist.append_column(self.column) self.dblist.append_column(self.column)
self.name_renderer = render
# build the icon column # build the icon column
render = gtk.CellRendererPixbuf() render = gtk.CellRendererPixbuf()
icon_column = gtk.TreeViewColumn(_('Status'), render, icon_column = gtk.TreeViewColumn(_('Status'), render,