Check-in [2956305120]
Overview
| Comment: | Add uikit.get_bg_color() for TreeView search, but keep #ffffff for Gtk2 |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
2956305120f934f2726ae23b69182000 |
| User & Date: | mario on 2020-12-12 15:10:00 |
| Other Links: | manifest | tags |
Context
|
2020-12-12
| ||
| 15:10 | Updated to 0.7.3 check-in: a8ede6f518 user: mario tags: trunk | |
| 15:10 | Add uikit.get_bg_color() for TreeView search, but keep #ffffff for Gtk2 check-in: 2956305120 user: mario tags: trunk | |
| 14:18 | try dual-dependencies on python2 & 3 check-in: 96049dfe04 user: mario tags: trunk | |
Changes
Modified channels/search.py from [f9517dd67a] to [d6cdcba529].
| ︙ | ︙ | |||
164 165 166 167 168 169 170 |
# compare against interesting content fields:
text = rows[i].get("title", "") + " " + rows[i].get("homepage", "")
# config.quicksearch_fields
text = text.lower()
# simple string match (probably doesn't need full search expression support)
if len(q) and text.find(q) >= 0:
| | | > > | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# compare against interesting content fields:
text = rows[i].get("title", "") + " " + rows[i].get("homepage", "")
# config.quicksearch_fields
text = text.lower()
# simple string match (probably doesn't need full search expression support)
if len(q) and text.find(q) >= 0:
model.set_value(iter, color, "#fe9") # highlighting color
model.set_value(iter, flag, True) # background-set flag
# color = 12 in liststore, flag = 13th position
else:
normal_bg = uikit.get_bg_color(self.main.channel().gtk_list)
#normal_bg = "#ffffff"
model.set_value(iter, color, normal_bg) # for some reason the cellrenderer colors get applied to all rows, even if we specify an iter (=treelist position?, not?)
model.set_value(iter, flag, False) # that's why we need the secondary -set option
#??
return False
# #ifdef PKG_ZIP
finder = """
|
| ︙ | ︙ |
Modified uikit.py from [42b5afa6c8] to [23eda88d68].
| ︙ | ︙ | |||
162 163 164 165 166 167 168 |
unicode: "",
bool: False,
int: 0,
gtk.gdk.Pixbuf: empty_pixbuf
}
if gtk.gdk.Pixbuf in vartypes:
pix_entry = vartypes.index(gtk.gdk.Pixbuf)
| | > | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
unicode: "",
bool: False,
int: 0,
gtk.gdk.Pixbuf: empty_pixbuf
}
if gtk.gdk.Pixbuf in vartypes:
pix_entry = vartypes.index(gtk.gdk.Pixbuf)
normal_bg = uikit.get_bg_color(widget)
# sort data into gtk liststore array
for row in entries:
# preset some values if absent
row.setdefault("deleted", False)
row.setdefault("search_col", normal_bg) #ffffff
row.setdefault("search_set", False)
# generate ordered list from dictionary, using rowmap association
row = [ row.get( skey , defaults[vartypes[i]] ) for i,skey in enumerate(rowmap) ]
# map Python2 unicode to str
row = [ str(value) if type(value) is unicode else value for value in row ]
|
| ︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# apply array to widget
widget.set_model(ls)
return ls, rowmap, pix_entry
pass
#-- treeview for categories
#
# simple two-level treeview display in one column
# with entries = [main,[sub,sub], title,[...],...]
#
| > > > > > > > > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# apply array to widget
widget.set_model(ls)
return ls, rowmap, pix_entry
pass
# figure out standard background
@staticmethod
def get_bg_color(widget):
try:
# Gtk3 only
normal_bg = widget.get_style_context().get_background_color(gtk.StateType.NORMAL)
normal_bg = normal_bg.to_string()
except:
normal_bg = "#ffffff" # Gtk2 default
return normal_bg
#-- treeview for categories
#
# simple two-level treeview display in one column
# with entries = [main,[sub,sub], title,[...],...]
#
|
| ︙ | ︙ |