Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 102060 Details for
Bug 85942
up2date clist has fixed-width columns
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh92 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Replace checklist.CheckList by GtkTreeView-based code
up2date-treeview.patch (text/plain), 18.44 KB, created by
Miloslav Trmač
on 2004-07-19 23:29:08 UTC
(
hide
)
Description:
Replace checklist.CheckList by GtkTreeView-based code
Filename:
MIME Type:
Creator:
Miloslav Trmač
Created:
2004-07-19 23:29:08 UTC
Size:
18.44 KB
patch
obsolete
>Binárnà soubory up2date-4.3.19/dmimodule.so a up2date/dmimodule.so jsou různé >diff --exclude '*.pyc' -urN up2date-4.3.19/gui.py up2date/gui.py >--- up2date-4.3.19/gui.py 2004-05-10 14:47:59.000000000 +0200 >+++ up2date/gui.py 2004-07-20 00:39:04.000000000 +0200 >@@ -395,8 +395,10 @@ > self.skippedArea.column_titles_show() > #self.skippedArea.focus_row = -1 > >- self.skippedArea.connect("select_row", self.showPackageInfo, >- (self.xml.get_widget("skippedPackageTextArea"))) >+ selection = self.skippedArea.get_selection() >+ selection.connect("changed", self.showPackageInfo, >+ (self.skippedArea, >+ self.xml.get_widget("skippedPackageTextArea"))) > window.add(self.skippedArea) > > self.xml.get_widget("skippedSelectAllButton").connect("toggled", >@@ -1079,8 +1081,10 @@ > self.channelArea.column_titles_show() > #self.channelArea.focus_row = -1 > >- self.channelArea.connect("select_row", self.showChannelInfo, >- (self.xml.get_widget("channelInfoTextArea"))) >+ selection = self.channelArea.get_selection() >+ selection.connect("changed", self.showChannelInfo, >+ (self.channelArea, >+ self.xml.get_widget("channelInfoTextArea"))) > > window.add(self.channelArea) > >@@ -1119,8 +1123,10 @@ > self.packageArea.column_titles_show() > self.packageArea.set_toggled_func(self.updateSelectedSize) > >- self.packageArea.connect("select_row", self.showPackageInfo, >- (self.xml.get_widget("packageInfoTextArea"))) >+ selection = self.packageArea.get_selection() >+ selection.connect("changed", self.showPackageInfo, >+ (self.packageArea, >+ self.xml.get_widget("packageInfoTextArea"))) > window.add(self.packageArea) > > >@@ -1152,8 +1158,10 @@ > self.availablePackageArea.column_titles_show() > self.availablePackageArea.set_toggled_func(self.updateAvailableSelectedSize) > >- self.availablePackageArea.connect("select_row", self.showPackageInfo, >- (self.xml.get_widget("availablePackageInfoTextArea"))) >+ selection = self.availablePackageArea.get_selection() >+ selection.connect("changed", self.showPackageInfo, >+ (self.availablePackageArea, >+ self.xml.get_widget("availablePackageInfoTextArea"))) > > window.add(self.availablePackageArea) > >@@ -1206,7 +1214,12 @@ > area._toggle_row(index) > > >- def showPackageInfo(self, area, row, column, event, textarea): >+ def showPackageInfo(self, selection, data): >+ (area, textarea) = data >+ (model, iter) = selection.get_selected() >+ if not iter: >+ return >+ row = area.store.get_path(iter)[-1] > self.currentRow = row > rowData = area.get_row_data(row) > hdr = up2date.getHeader(rowData[1],lite=1) >@@ -1215,7 +1228,12 @@ > buffer.set_text(labeltext) > textarea.set_buffer(buffer) > >- def showChannelInfo(self, area, row, column, event, textarea): >+ def showChannelInfo(self, selection, data): >+ (area, textarea) = data >+ (model, iter) = selection.get_selected() >+ if not iter: >+ return >+ row = area.store.get_path(iter)[-1] > # FIXME? rpc to get extended channel info? > (row,data) = area.get_row_data(row) > try: >diff --exclude '*.pyc' -urN up2date-4.3.19/checklist.py up2date/checklist.py >--- up2date-4.3.19/checklist.py 2002-08-22 04:36:50.000000000 +0200 >+++ up2date/checklist.py 2004-07-20 01:20:02.000000000 +0200 >@@ -1,63 +1,95 @@ >-#/usr/bin/python >- >-# Client code for Update Agent >-# Copyright (c) 1999-2002 Red Hat, Inc. Distributed under GPL. > # >-# Author: Preston Brown <pbrown@redhat.com> >- >- >+# checklist.py: A class (derived from GtkTreeView) that provides a list of >+# checkbox / text string pairs >+# >+# Brent Fox <bfox@redhat.com> >+# Jeremy Katz <katzj@redhat.com> >+# Miloslav Trmac <mitr@redhat.com> >+# >+# Copyright 2000-2001, 2004 Red Hat, Inc. >+# >+# This software may be freely redistributed under the terms of the GNU >+# library public license. >+# >+# You should have received a copy of the GNU Library Public License >+# along with this program; if not, write to the Free Software >+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. >+# > >-#from gtk import * > import gtk >-import gtk._gtk >+import gobject > >- >-class CheckList (gtk.CList): >- """A class (derived from GtkCList) that provides a list of >+class CheckList (gtk.TreeView): >+ """A class (derived from gtk.TreeView) that provides a list of > checkbox / text string pairs""" >- CHECK_SIZE = 13 >- >- def __init__ (self, columns = 1): >- gtk.CList.__init__ (self, columns+1) >- >- self.set_column_auto_resize(0, 1) >- #for i in range(columns): >- # self.set_column_auto_resize (i, 1) >- >- def debug_cb (widget): >- print widget >- >- self.connect ("realize", self._realize_cb) >- self.connect ("button_press_event", self._button_press_cb) >- self.connect ("key_press_event", self._key_press_cb) > >- self.off_pixmap = None >- self.on_pixmap = None >+ # override this to make your own columns if necessary >+ def create_columns(self, columns): >+ # add the string columns to the tree view widget >+ for i in range(1, columns + 1): >+ renderer = gtk.CellRendererText() >+ column = gtk.TreeViewColumn('Text', renderer, text=i) >+ column.set_clickable(gtk.FALSE) >+ column.set_resizable(gtk.TRUE) >+ self.append_column(column) >+ >+ def __init__ (self, columns = 1, custom_store=None): >+ if custom_store is None: >+ types = [gobject.TYPE_BOOLEAN] >+ for i in range(1, columns + 1): >+ types.append(gobject.TYPE_STRING) >+ types.append(gobject.TYPE_OBJECT) >+ self.store = gtk.TreeStore(*types) >+ else: >+ self.store = custom_store >+ >+ gtk.TreeView.__init__ (self, self.store) >+ >+ # Not including the hidden data column >+ self.columns = columns >+ >+ self.checkboxrenderer = gtk.CellRendererToggle() >+ column = gtk.TreeViewColumn('', self.checkboxrenderer, active=0) >+# column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) >+# column.set_fixed_width(40) >+ column.set_clickable(gtk.TRUE) >+ column.set_resizable(gtk.TRUE) >+ self.checkboxrenderer.connect ("toggled", self.toggled_item) >+ self.append_column(column) >+ >+ self.create_columns(columns) >+ >+ self.set_rules_hint(gtk.FALSE) >+ self.set_headers_visible(gtk.FALSE) >+ self.columns_autosize() >+ self.set_enable_search(gtk.FALSE) > > self.toggled_func = None > >+ # keep track of the number of rows we have so we can >+ # iterate over them all > self.n_rows = 0 > >- def append_row (self, textList, init_value, row_data=None): >+ def append_row (self, textList, init_value, row_data = None): > """Add a row to the list. > text: text to display in the row > init_value: initial state of the indicator >- row_data: data to pass to the toggled_func callback""" >+ row_data: datato pass to the toggled_func callback""" > >- textList = ("",) + textList >- row = self.append (textList) >- self.set_row_data (row, (not not init_value, row_data)) >- self.n_rows = self.n_rows + 1 >+ iter = self.store.append(None) >+ self.store.set_value(iter, 0, init_value) > >- if (self.flags() & gtk.REALIZED): >- self._update_row (row) >+ # add the text for the number of columns we have >+ i = 1 >+ for text in textList[:self.columns]: >+ self.store.set_value(iter, i, textList[i - 1]) >+ i = i + 1 >+ o = gobject.GObject() >+ o.set_data("data", row_data) >+ self.store.set_value(iter, self.columns + 1, o) > >- return row >+ self.n_rows = self.n_rows + 1 > >- def clear (self): >- "Remove all rows" >- gtk.CList.clear(self) >- self.n_rows = 0 > > def set_toggled_func (self, func): > """Set a function to be called when the value of a row is toggled. >@@ -65,85 +97,130 @@ > of the indicator (boolean) and the row_data for the row.""" > self.toggled_func = func > >- def _update_row (self, row): >- (val, row_data) = self.get_row_data(row) >+ def _toggle_row(self, row): >+ "Toggle checkbox in row" >+ iter = self.store.get_iter((int(row),)) >+ val = not self.store.get_value(iter, 0) >+ self.store.set_value(iter, 0, val) >+ if self.toggled_func: >+ o = self.store.get_value(iter, self.columns + 1) >+ self.toggled_func(val, o.get_data("data")) > >- if val: >- self.set_pixmap(row,0,self.on_pixmap,self.mask) >- else: >- self.set_pixmap(row,0,self.off_pixmap,self.mask) > >+ def toggled_item(self, data, row): >+ "Callback when checkbox in row is toggled" >+ self._toggle_row(row) >+ > >- def _color_pixmaps(self): >- style = self.get_style() >- base_gc = self.on_pixmap.new_gc(foreground = style.base[gtk._gtk.STATE_NORMAL]) >- text_gc = self.on_pixmap.new_gc(foreground = style.text[gtk._gtk.STATE_NORMAL]) >- >- self.mask = gtk.create_pixmap(None,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE,1) >- # HACK - we really want to just use a color with a pixel value of 1 >- mask_gc = self.mask.new_gc (foreground = self.get_style().white) >- self.mask.draw_rectangle(mask_gc,1,0,0,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >- >-# draw_rectangle(self.mask,mask_gc,1,0,0,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >- >- self.on_pixmap.draw_rectangle(base_gc,1,0,0,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >-# draw_rectangle(self.on_pixmap,base_gc,1,0,0,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >-# draw_rectangle(self.on_pixmap,text_gc,0,0,0,CheckList.CHECK_SIZE-1,CheckList.CHECK_SIZE-1) >- self.on_pixmap.draw_rectangle(text_gc,0,0,0,CheckList.CHECK_SIZE-1,CheckList.CHECK_SIZE-1) >- >-# draw_line(self.on_pixmap,text_gc,2, CheckList.CHECK_SIZE/2,CheckList.CHECK_SIZE/3,CheckList.CHECK_SIZE-5) >- self.on_pixmap.draw_line(text_gc,2, CheckList.CHECK_SIZE/2,CheckList.CHECK_SIZE/3,CheckList.CHECK_SIZE-5) >- #draw_line(self.on_pixmap,text_gc,2, CheckList.CHECK_SIZE/2+1,CheckList.CHECK_SIZE/3,CheckList.CHECK_SIZE-4) >- self.on_pixmap.draw_line(text_gc,2, CheckList.CHECK_SIZE/2+1,CheckList.CHECK_SIZE/3,CheckList.CHECK_SIZE-4) >- #draw_line(self.on_pixmap,text_gc,CheckList.CHECK_SIZE/3, CheckList.CHECK_SIZE-5, CheckList.CHECK_SIZE-3, 3) >- self.on_pixmap.draw_line(text_gc,CheckList.CHECK_SIZE/3, CheckList.CHECK_SIZE-5, CheckList.CHECK_SIZE-3, 3) >- >- #draw_line(self.on_pixmap,text_gc,CheckList.CHECK_SIZE/3, CheckList.CHECK_SIZE-4, CheckList.CHECK_SIZE-3, 2) >- self.on_pixmap.draw_line(text_gc,CheckList.CHECK_SIZE/3, CheckList.CHECK_SIZE-4, CheckList.CHECK_SIZE-3, 2) >- #draw_rectangle(self.off_pixmap,base_gc,1,0,0,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >- self.off_pixmap.draw_rectangle(base_gc,1,0,0,CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >- #draw_rectangle(self.off_pixmap,text_gc,0,0,0,CheckList.CHECK_SIZE-1,CheckList.CHECK_SIZE-1) >- self.off_pixmap.draw_rectangle(text_gc,0,0,0,CheckList.CHECK_SIZE-1,CheckList.CHECK_SIZE-1) >- >- def _realize_cb (self, clist): >- self.on_pixmap = gtk.create_pixmap(self.window, CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >- self.off_pixmap = gtk.create_pixmap(self.window, CheckList.CHECK_SIZE,CheckList.CHECK_SIZE) >- >- # We can't connect this callback before because of a bug in PyGtk where it doesn't >- # like style_set to be called with a NULL old_style >- self.connect ("style_set", lambda self, old_style: self._color_pixmaps) >- self._color_pixmaps() >- >- for i in range (self.n_rows): >- self._update_row (i) >- >- def _toggle_row (self, row): >- (val, row_data) = self.get_row_data(row) >- val = not val >- self.set_row_data(row, (val, row_data)) >- >- self._update_row (row) >- >- if self.toggled_func != None: >- self.toggled_func(val, row_data) >+ def clear (self): >+ "Remove all rows" >+ self.store.clear() >+ self.n_rows = 0 >+ >+ >+ def get_active(self, row): >+ """Return FALSE or TRUE as to whether or not the row is toggled >+ similar to GtkToggleButtons""" >+ >+ iter = self.store.get_iter((row,)) >+ return self.store.get_value(iter, 0) >+ >+ >+ def set_active(self, row, is_active): >+ "Set row to be is_active, similar to GtkToggleButton" >+ >+ iter = self.store.get_iter((row,)) >+ self.store.set_value(iter, 0, is_active) > >- def _key_press_cb (self, clist, event): >- if event.keyval == ord(" ") and self.focus_row != -1: >- self._toggle_row (self.focus_row) >- self.emit_stop_by_name ("key_press_event") >- return 1 > >- return 0 >+ def get_text(self, row, column): >+ "Get the text from row and column" >+ >+ iter = self.store.get_iter((row,)) >+ return self.store.get_value(iter, column) >+ >+ >+ def get_row_data(self, row): >+ "Get the user data from row" >+ >+ iter = self.store.get_iter((row,)) >+ o = self.store.get_value(iter, self.columns + 1) >+ return (self.store.get_value(iter, 0), o.get_data("data")) >+ >+ >+ def set_column_title(self, column, title): >+ "Set the title of column to title" >+ >+ col = self.get_column(column) >+ if col: >+ col.set_title(title) >+ >+ >+ def set_column_min_width(self, column, min): >+ "Set the minimum width of column to min" >+ >+ col = self.get_column(column) >+ if col: >+ col.set_min_width(min) >+ >+ >+ def set_column_clickable(self, column, clickable): >+ "Set the column to be clickable" >+ >+ col = self.get_column(column) >+ if col: >+ col.set_clickable(clickable) > >- def _button_press_cb (self, clist, event): >- info = self.get_selection_info (event.x, event.y) >- if info != None: >- if info[1] == 0: >- self._toggle_row (info[0]) >-# self.emit_stop_by_name ("button_press_event") >- return 1 > >- return 0 >+ def set_column_sizing(self, column, sizing): >+ "Set the column to use the given sizing method" > >- >- >+ col = self.get_column(column) >+ if col: >+ col.set_sizing(sizing) >+ >+ def set_column_sort_id(self, column, id): >+ "Set the sort id of column to id" >+ >+ col = self.get_column(column) >+ if col: >+ col.set_sort_column_id(id) >+ >+ >+ def column_titles_show(self): >+ self.set_headers_visible(gtk.TRUE) >+ >+ >+ def select_row(self, row, column): >+ iter = self.store.get_iter((row,)) >+ self.set_cursor(self.store.get_path(iter), self.get_column(column), >+ gtk.FALSE) >+ >+ >+ def freeze(self): >+ pass >+ >+ >+ def thaw(self): >+ pass >+ >+ >+def main(): >+ win = gtk.Window() >+ cl = CheckList(1) >+ for i in range(1, 10): >+ cl.append_row("%s" %(i,), gtk.FALSE) >+ >+ sw = gtk.ScrolledWindow() >+ sw.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) >+ sw.add (cl) >+ sw.set_shadow_type(gtk.SHADOW_IN) >+ >+ win.add(sw) >+ win.set_size_request(250, 250) >+ win.show_all() >+ >+ gtk.main() >+ >+if __name__ == "__main__": >+ main() >Binárnà soubory up2date-4.3.19/po/ar.mo a up2date/po/ar.mo jsou různé >Binárnà soubory up2date-4.3.19/po/bn.mo a up2date/po/bn.mo jsou různé >Binárnà soubory up2date-4.3.19/po/ca.mo a up2date/po/ca.mo jsou různé >Binárnà soubory up2date-4.3.19/po/cs.mo a up2date/po/cs.mo jsou různé >Binárnà soubory up2date-4.3.19/po/cy.mo a up2date/po/cy.mo jsou různé >Binárnà soubory up2date-4.3.19/po/da.mo a up2date/po/da.mo jsou různé >Binárnà soubory up2date-4.3.19/po/de.mo a up2date/po/de.mo jsou různé >Binárnà soubory up2date-4.3.19/po/el.mo a up2date/po/el.mo jsou různé >Binárnà soubory up2date-4.3.19/po/es.mo a up2date/po/es.mo jsou různé >Binárnà soubory up2date-4.3.19/po/fi.mo a up2date/po/fi.mo jsou různé >Binárnà soubory up2date-4.3.19/po/fr.mo a up2date/po/fr.mo jsou různé >Binárnà soubory up2date-4.3.19/po/hi.mo a up2date/po/hi.mo jsou různé >Binárnà soubory up2date-4.3.19/po/hr.mo a up2date/po/hr.mo jsou různé >Binárnà soubory up2date-4.3.19/po/hu.mo a up2date/po/hu.mo jsou různé >Binárnà soubory up2date-4.3.19/po/is.mo a up2date/po/is.mo jsou různé >Binárnà soubory up2date-4.3.19/po/it.mo a up2date/po/it.mo jsou různé >Binárnà soubory up2date-4.3.19/po/ja.mo a up2date/po/ja.mo jsou různé >Binárnà soubory up2date-4.3.19/po/ko.mo a up2date/po/ko.mo jsou různé >Binárnà soubory up2date-4.3.19/po/ms.mo a up2date/po/ms.mo jsou různé >Binárnà soubory up2date-4.3.19/po/nl.mo a up2date/po/nl.mo jsou různé >Binárnà soubory up2date-4.3.19/po/no.mo a up2date/po/no.mo jsou různé >Binárnà soubory up2date-4.3.19/po/pa.mo a up2date/po/pa.mo jsou různé >Binárnà soubory up2date-4.3.19/po/pl.mo a up2date/po/pl.mo jsou různé >Binárnà soubory up2date-4.3.19/po/pt_BR.mo a up2date/po/pt_BR.mo jsou různé >Binárnà soubory up2date-4.3.19/po/pt.mo a up2date/po/pt.mo jsou různé >Binárnà soubory up2date-4.3.19/po/ro.mo a up2date/po/ro.mo jsou různé >Binárnà soubory up2date-4.3.19/po/ru.mo a up2date/po/ru.mo jsou různé >Binárnà soubory up2date-4.3.19/po/sl.mo a up2date/po/sl.mo jsou různé >Binárnà soubory up2date-4.3.19/po/sq.mo a up2date/po/sq.mo jsou různé >Binárnà soubory up2date-4.3.19/po/sv.mo a up2date/po/sv.mo jsou různé >Binárnà soubory up2date-4.3.19/po/tr.mo a up2date/po/tr.mo jsou různé >Binárnà soubory up2date-4.3.19/po/uk.mo a up2date/po/uk.mo jsou různé >Binárnà soubory up2date-4.3.19/po/zh_CN.GB2312.mo a up2date/po/zh_CN.GB2312.mo jsou různé >Binárnà soubory up2date-4.3.19/po/zh_CN.mo a up2date/po/zh_CN.mo jsou různé >Binárnà soubory up2date-4.3.19/po/zh_TW.Big5.mo a up2date/po/zh_TW.Big5.mo jsou různé >Binárnà soubory up2date-4.3.19/po/zh_TW.mo a up2date/po/zh_TW.mo jsou různé >Binárnà soubory up2date-4.3.19/rhnsd a up2date/rhnsd jsou různé >Binárnà soubory up2date-4.3.19/rhnsd.o a up2date/rhnsd.o jsou různé
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 85942
:
90548
| 102060