added separate column for picon to fav list

This commit is contained in:
DYefremov
2021-01-07 10:51:41 +03:00
parent 2f55fb4e64
commit 1113fec26e
2 changed files with 331 additions and 294 deletions

View File

@@ -1017,9 +1017,10 @@ class Application(Gtk.Application):
"""
rows = self._fav_model if len(paths) < 2 else [self._fav_model[p] for p in paths]
index = int(str(rows[0].path))
columns = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for s_row, row in zip(sorted(map(lambda r: r[:], rows), key=lambda r: r[c_num] or nv, reverse=rev), rows):
self._fav_model.set_row(row.iter, s_row)
self._fav_model.set(row.iter, columns, s_row)
bq[index] = s_row[Column.FAV_ID]
index += 1
@@ -1817,7 +1818,8 @@ class Application(Gtk.Application):
for index, s in enumerate(srv[-1] or [], start=1):
srv = self._services.get(s.data, None)
if srv:
self._alt_model.append((index, srv.service, srv.service_type, srv.pos))
picon = self._picons.get(srv.picon_id, None)
self._alt_model.append((index, picon, srv.service, srv.service_type, srv.pos))
self._alt_revealer.set_visible(True)
else:
self._alt_revealer.set_visible(False)
@@ -1890,9 +1892,17 @@ class Application(Gtk.Application):
if not is_marker:
num += 1
picon = self._picons.get(srv.picon_id, None)
# Alternatives
if srv.service_type == BqServiceType.ALT.name:
alt_servs = srv.transponder
if alt_servs:
alt_srv = self._services.get(alt_servs[0].data, None)
picon = self._picons.get(alt_srv.picon_id, None) if srv else None
self._fav_model.append((0 if is_marker else num, srv.coded, ex_srv_name if ex_srv_name else srv.service,
srv.locked, srv.hide, srv_type, srv.pos, srv.fav_id,
self._picons.get(srv.picon_id, None), None, background))
picon, None, background))
yield True
self._fav_view.set_model(self._fav_model)

View File

@@ -37,6 +37,8 @@ Author: Dmitriy Yefremov
<columns>
<!-- column-name num -->
<column type="gint"/>
<!-- column-name picon -->
<column type="GdkPixbuf"/>
<!-- column-name service -->
<column type="gchararray"/>
<!-- column-name type -->
@@ -2410,320 +2412,345 @@ Author: Dmitriy Yefremov
</child>
<child>
<object class="GtkBox" id="fav_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">2</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkScrolledWindow" id="fav_scrolled_window">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">2</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkScrolledWindow" id="fav_scrolled_window">
<object class="GtkTreeView" id="fav_tree_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<property name="can_focus">True</property>
<property name="model">fav_list_store</property>
<property name="enable_search">False</property>
<property name="search_column">2</property>
<property name="rubber_banding">True</property>
<property name="enable_grid_lines">both</property>
<property name="tooltip_column">9</property>
<property name="activate_on_single_click">True</property>
<signal name="button-press-event" handler="on_fav_press" object="fav_popup_menu" swapped="no"/>
<signal name="button-press-event" handler="on_view_press" swapped="yes"/>
<signal name="button-release-event" handler="on_view_release" swapped="no"/>
<signal name="drag-begin" handler="on_view_drag_begin" after="yes" swapped="no"/>
<signal name="drag-data-get" handler="on_view_drag_data_get" swapped="no"/>
<signal name="drag-data-received" handler="on_view_drag_data_received" swapped="no"/>
<signal name="drag-end" handler="on_view_drag_end" swapped="no"/>
<signal name="focus-in-event" handler="on_view_focus" swapped="no"/>
<signal name="key-press-event" handler="on_tree_view_key_press" swapped="no"/>
<signal name="key-release-event" handler="on_tree_view_key_release" swapped="no"/>
<signal name="query-tooltip" handler="on_fav_view_query_tooltip" swapped="no"/>
<signal name="row-activated" handler="on_fav_selection" object="fav_list_store" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="fav_selection">
<property name="mode">multiple</property>
</object>
</child>
<child>
<object class="GtkTreeView" id="fav_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">fav_list_store</property>
<property name="enable_search">False</property>
<property name="search_column">2</property>
<property name="rubber_banding">True</property>
<property name="enable_grid_lines">both</property>
<property name="tooltip_column">9</property>
<property name="activate_on_single_click">True</property>
<signal name="button-press-event" handler="on_fav_press" object="fav_popup_menu" swapped="no"/>
<signal name="button-press-event" handler="on_view_press" swapped="yes"/>
<signal name="button-release-event" handler="on_view_release" swapped="no"/>
<signal name="drag-begin" handler="on_view_drag_begin" after="yes" swapped="no"/>
<signal name="drag-data-get" handler="on_view_drag_data_get" swapped="no"/>
<signal name="drag-data-received" handler="on_view_drag_data_received" swapped="no"/>
<signal name="drag-end" handler="on_view_drag_end" swapped="no"/>
<signal name="focus-in-event" handler="on_view_focus" swapped="no"/>
<signal name="key-press-event" handler="on_tree_view_key_press" swapped="no"/>
<signal name="key-release-event" handler="on_tree_view_key_release" swapped="no"/>
<signal name="query-tooltip" handler="on_fav_view_query_tooltip" swapped="no"/>
<signal name="row-activated" handler="on_fav_selection" object="fav_list_store" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="fav_selection">
<property name="mode">multiple</property>
<object class="GtkTreeViewColumn" id="fav_num_column">
<property name="resizable">True</property>
<property name="min_width">25</property>
<property name="title" translatable="yes">Num</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="num_cellrenderertext">
<property name="xalign">0.49000000953674316</property>
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="visible">0</attribute>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_picon_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Picon</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererPixbuf" id="fav_picon_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">8</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_service_column">
<property name="resizable">True</property>
<property name="min_width">50</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererPixbuf" id="fav_coded_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_num_column">
<property name="resizable">True</property>
<property name="min_width">25</property>
<property name="title" translatable="yes">Num</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="num_cellrenderertext">
<property name="xalign">0.20000000298023224</property>
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="visible">0</attribute>
<attribute name="text">0</attribute>
</attributes>
</child>
<object class="GtkCellRendererText" id="fav_service_cellrenderertext">
<property name="ellipsize">end</property>
<property name="width_chars">25</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="text">2</attribute>
</attributes>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_service_column">
<property name="resizable">True</property>
<property name="min_width">50</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererPixbuf" id="fav_picon_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">8</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_coded_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="fav_service_cellrenderertext">
<property name="ellipsize">end</property>
<property name="width_chars">25</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="text">2</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_locked_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">3</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_hide_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">4</attribute>
</attributes>
</child>
<object class="GtkCellRendererPixbuf" id="fav_locked_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">3</attribute>
</attributes>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_type_column">
<property name="resizable">True</property>
<property name="min_width">25</property>
<property name="title" translatable="yes">Type</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="type_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="text">5</attribute>
</attributes>
</child>
<object class="GtkCellRendererPixbuf" id="fav_hide_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="pixbuf">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_type_column">
<property name="resizable">True</property>
<property name="min_width">25</property>
<property name="title" translatable="yes">Type</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="type_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_pos_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Pos</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="pos_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_id_column">
<property name="visible">False</property>
<property name="title">fav_id</property>
<child>
<object class="GtkCellRendererText" id="fav_id_cellrenderertext4"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_extra_column">
<property name="visible">False</property>
<property name="title" translatable="yes">extra</property>
<child>
<object class="GtkCellRendererText" id="fav_tooltip_cellrenderertext"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_pos_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Pos</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<property name="alignment">0.5</property>
<signal name="clicked" handler="on_fav_sort" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="pos_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="cell-background-rgba">10</attribute>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_id_column">
<property name="visible">False</property>
<property name="title">fav_id</property>
<child>
<object class="GtkCellRendererText" id="fav_id_cellrenderertext4"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_extra_column">
<property name="visible">False</property>
<property name="title" translatable="yes">extra</property>
<child>
<object class="GtkCellRendererText" id="fav_tooltip_cellrenderertext"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_background_cellrenderertext"/>
</child>
</object>
<object class="GtkCellRendererPixbuf" id="fav_background_cellrenderertext"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="alt_revealer">
<property name="can_focus">False</property>
<property name="transition_type">slide-up</property>
<child>
<object class="GtkBox" id="alt_box">
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="alt_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Alternatives</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="alt_scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="alt_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">alt_list_store</property>
<property name="enable_search">False</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_num_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Num</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_num_cellrenderertext">
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_service_column">
<property name="resizable">True</property>
<property name="min_width">50</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_service_cellrenderertext"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_type_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Type</property>
<property name="expand">True</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_type_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_pos_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Pos</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_pos_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="alt_revealer">
<property name="can_focus">False</property>
<property name="transition_type">slide-up</property>
<child>
<object class="GtkBox" id="alt_box">
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="alt_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Alternatives</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="alt_scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="alt_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">alt_list_store</property>
<property name="enable_search">False</property>
<property name="enable_grid_lines">both</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="alt_selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_num_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Num</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_num_cellrenderertext">
<property name="xalign">0.49000000953674316</property>
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_picon_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Picon</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererPixbuf" id="alt_picon_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_service_column">
<property name="resizable">True</property>
<property name="min_width">50</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_service_cellrenderertext">
<property name="xalign">0.10000000149011612</property>
</object>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_type_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Type</property>
<property name="expand">True</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_type_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alt_pos_column">
<property name="min_width">25</property>
<property name="title" translatable="yes">Pos</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererText" id="alt_pos_cellrenderertext">
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>