From 7d442f88d518c464743d037420593eeb817206cf Mon Sep 17 00:00:00 2001 From: Marko Mecina <marko.mecina@univie.ac.at> Date: Mon, 4 Nov 2024 18:07:44 +0100 Subject: [PATCH] don't use gtk-specific icon names --- Ccs/pixmap/document-open-folder.svg | 10 +++++++++ Ccs/pixmap/document-save.svg | 8 +++++++ Ccs/pixmap/edit-clear.svg | 10 +++++++++ Ccs/pixmap/edit-paste.svg | 10 +++++++++ Ccs/pixmap/format-justify-fill.svg | 10 +++++++++ Ccs/pixmap/media-playback-stop.svg | 8 +++++++ Ccs/pixmap/media-record.svg | 10 +++++++++ Ccs/pixmap/text-x-python.svg | 9 ++++++++ Ccs/pixmap/x-office-spreadsheet.svg | 9 ++++++++ Ccs/plotter.py | 7 +++--- Ccs/poolview_sql.py | 34 +++++++++++++++++++++++------ Tst/tst/tst.py | 10 +++++++-- 12 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 Ccs/pixmap/document-open-folder.svg create mode 100644 Ccs/pixmap/document-save.svg create mode 100644 Ccs/pixmap/edit-clear.svg create mode 100644 Ccs/pixmap/edit-paste.svg create mode 100644 Ccs/pixmap/format-justify-fill.svg create mode 100644 Ccs/pixmap/media-playback-stop.svg create mode 100644 Ccs/pixmap/media-record.svg create mode 100644 Ccs/pixmap/text-x-python.svg create mode 100644 Ccs/pixmap/x-office-spreadsheet.svg diff --git a/Ccs/pixmap/document-open-folder.svg b/Ccs/pixmap/document-open-folder.svg new file mode 100644 index 0000000..ac92ecd --- /dev/null +++ b/Ccs/pixmap/document-open-folder.svg @@ -0,0 +1,10 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <g transform="matrix(1,0,0,1,4,4)"> + <path class="ColorScheme-Text" d="M 1,3 V 14 C 1,14 1,15 2,15 H 14 C 14,15 15,15 15,14 V 5 C 15,4 14,4 14,4 H 9 L 7,2 H 2 C 2,2 1,2 1,3 Z" style="fill:currentColor"/> + </g> +</svg> diff --git a/Ccs/pixmap/document-save.svg b/Ccs/pixmap/document-save.svg new file mode 100644 index 0000000..bea9c52 --- /dev/null +++ b/Ccs/pixmap/document-save.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <path style="fill:currentColor" class="ColorScheme-Text" d="m 18,19 c 0.55,0 1,-0.45 1,-1 V 7 L 17,5 H 6 C 5.45,5 5,5.45 5,6 v 12 c 0,0.55 0.45,1 1,1 z M 17,17 H 7 V 7 h 1 v 5 h 8 V 7 h 1 z M 12,11 H 10 V 7 h 2 z"/> +</svg> diff --git a/Ccs/pixmap/edit-clear.svg b/Ccs/pixmap/edit-clear.svg new file mode 100644 index 0000000..96c9f2d --- /dev/null +++ b/Ccs/pixmap/edit-clear.svg @@ -0,0 +1,10 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <g transform="matrix(1,0,0,1,4,4)"> + <path class="ColorScheme-Text" d="M 5,2 0,8 5,14 H 16 V 2 Z M 7,5 H 8 C 8.28,5 8.53,5.11 8.71,5.29 L 10,6.59 11.29,5.29 C 11.47,5.11 11.72,5 12,5 H 13 V 6 C 13,6.28 12.89,6.53 12.71,6.71 L 11.41,8 12.71,9.29 C 12.89,9.47 13,9.72 13,10 V 11 H 12 C 11.72,11 11.47,10.89 11.29,10.71 L 10,9.41 8.71,10.71 C 8.53,10.89 8.28,11 8,11 H 7 V 10 C 7,9.72 7.11,9.47 7.29,9.29 L 8.59,8 7.29,6.71 C 7.11,6.53 7,6.28 7,6 Z" style="fill:currentColor"/> + </g> +</svg> diff --git a/Ccs/pixmap/edit-paste.svg b/Ccs/pixmap/edit-paste.svg new file mode 100644 index 0000000..7fa57f4 --- /dev/null +++ b/Ccs/pixmap/edit-paste.svg @@ -0,0 +1,10 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <g transform="matrix(1,0,0,1,4,4)"> + <path class="ColorScheme-Text" d="M 8 0 A 2 2 0 0 0 6 2 L 3 2 C 2.446 2 2 2.446 2 3 L 2 14 C 2 14.554 2.446 15 3 15 L 13 15 C 13.554 15 14 14.554 14 14 L 14 3 C 14 2.446 13.554 2 13 2 L 10 2 A 2 2 0 0 0 8 0 z M 8 1 A 1 1 0 0 1 9 2 A 1 1 0 0 1 8 3 A 1 1 0 0 1 7 2 A 1 1 0 0 1 8 1 z M 4 4 L 5 4 L 5 5 L 11 5 L 11 4 L 12 4 L 12 13 L 4 13 L 4 4 z" style="fill:currentColor"/> + </g> +</svg> diff --git a/Ccs/pixmap/format-justify-fill.svg b/Ccs/pixmap/format-justify-fill.svg new file mode 100644 index 0000000..4f26428 --- /dev/null +++ b/Ccs/pixmap/format-justify-fill.svg @@ -0,0 +1,10 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <g transform="translate(4,4)"> + <path style="fill:currentColor" class="ColorScheme-Text" d="M 1,1 V 3 H 15 V 1 Z M 1,5 V 7 H 15 V 5 Z M 1,9 V 11 H 15 V 9 Z M 1,13 V 15 H 15 V 13 Z"/> + </g> +</svg> diff --git a/Ccs/pixmap/media-playback-stop.svg b/Ccs/pixmap/media-playback-stop.svg new file mode 100644 index 0000000..1305eda --- /dev/null +++ b/Ccs/pixmap/media-playback-stop.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <path style="fill:currentColor" class="ColorScheme-Text" d="M 2 2 L 2 14 L 14 14 L 14 2 L 2 2 z" transform="translate(4 4)"/> +</svg> diff --git a/Ccs/pixmap/media-record.svg b/Ccs/pixmap/media-record.svg new file mode 100644 index 0000000..b4cb056 --- /dev/null +++ b/Ccs/pixmap/media-record.svg @@ -0,0 +1,10 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1"> + <defs> + <style id="current-color-scheme" type="text/css"> + .ColorScheme-Text { color:#444444; } .ColorScheme-Highlight { color:#4285f4; } .ColorScheme-NeutralText { color:#ff9800; } .ColorScheme-PositiveText { color:#4caf50; } .ColorScheme-NegativeText { color:#f44336; } + </style> + </defs> + <g transform="translate(4,4)"> + <path style="fill:currentColor" class="ColorScheme-Text" d="M 13,8 A 5,5 0 0 1 8,13 5,5 0 0 1 3,8 5,5 0 0 1 8,3 5,5 0 0 1 13,8 Z"/> + </g> +</svg> diff --git a/Ccs/pixmap/text-x-python.svg b/Ccs/pixmap/text-x-python.svg new file mode 100644 index 0000000..0973e78 --- /dev/null +++ b/Ccs/pixmap/text-x-python.svg @@ -0,0 +1,9 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" version="1.1"> + <path style="opacity:0.2" d="M 12.75,5 C 11.2265,5 10,6.2488 10,7.8 v 50.4 c 0,1.55008 1.2265,2.8 2.75,2.8 h 38.5 C 52.7724,61 54,59.75008 54,58.2 V 23 L 40,19 36,5 Z"/> + <path style="fill:#e4e4e4" d="M 12.75,4 C 11.2265,4 10,5.2488 10,6.8 v 50.4 c 0,1.55008 1.2265,2.8 2.75,2.8 h 38.5 C 52.7724,60 54,58.75008 54,57.2 V 22 L 40,18 36,4 Z"/> + <path style="opacity:0.2" d="M 54,23 36,5 V 20.1875 C 36,21.74675 37.2555,23 38.8125,23 Z"/> + <path style="fill:#fafafa" d="M 54,22 36,4 V 19.1875 C 36,20.74675 37.2555,22 38.8125,22 Z"/> + <path style="opacity:0.2;fill:#ffffff" d="M 12.75 4 C 11.2265 4 10 5.2495812 10 6.8007812 L 10 7.8007812 C 10 6.2495813 11.2265 5 12.75 5 L 36 5 L 36 4 L 12.75 4 z"/> + <path style="fill:#ffa923" d="M 39 34 L 39 37.5 C 39 39.439 37.439 41 35.5 41 L 28.5 41 C 28.5 41 25 41 25 44.5 L 25 50.625 C 25 53.0484 27.7314 55 31.125 55 L 32.875 55 C 36.2686 55 39 53.0484 39 50.625 L 39 48 L 41.625 48 C 44.0484 48 46 45.2686 46 41.875 L 46 40.125 C 46 36.7314 44.0484 34 41.625 34 L 39 34 z M 36.5 49 A 1.5 1.5 0 0 1 38 50.5 A 1.5 1.5 0 0 1 36.5 52 A 1.5 1.5 0 0 1 35 50.5 A 1.5 1.5 0 0 1 36.5 49 z"/> + <path style="fill:#3084e0" d="M 31.125 27 C 27.7314 27 25 28.9516 25 31.375 L 25 34 L 22.375 34 C 19.9516 34 18 36.7314 18 40.125 L 18 41.875 C 18 45.2686 19.9516 48 22.375 48 L 25 48 L 25 44.5 C 25 42.561 26.561 41 28.5 41 L 35.5 41 C 35.5 41 39 41 39 37.5 L 39 31.375 C 39 28.9516 36.2686 27 32.875 27 L 31.125 27 z M 27.5 30 A 1.5 1.5 0 0 1 29 31.5 A 1.5 1.5 0 0 1 27.5 33 A 1.5 1.5 0 0 1 26 31.5 A 1.5 1.5 0 0 1 27.5 30 z"/> +</svg> diff --git a/Ccs/pixmap/x-office-spreadsheet.svg b/Ccs/pixmap/x-office-spreadsheet.svg new file mode 100644 index 0000000..fa44371 --- /dev/null +++ b/Ccs/pixmap/x-office-spreadsheet.svg @@ -0,0 +1,9 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" version="1.1"> + <path style="opacity:0.2" d="M 12.75,5 C 11.2265,5 10,6.2488 10,7.8 v 50.4 c 0,1.55008 1.2265,2.8 2.75,2.8 h 38.5 C 52.7724,61 54,59.75008 54,58.2 V 23 L 40,19 36,5 Z"/> + <path style="fill:#4bae4f" d="M 12.75,4 C 11.2265,4 10,5.2488 10,6.8 v 50.4 c 0,1.55008 1.2265,2.8 2.75,2.8 h 38.5 C 52.7724,60 54,58.75008 54,57.2 V 22 L 40,18 36,4 Z"/> + <path style="opacity:0.2" d="M 54,23 36,5 V 20.1875 C 36,21.74675 37.2555,23 38.8125,23 Z"/> + <path style="fill:#95cd97" d="M 54,22 36,4 V 19.1875 C 36,20.74675 37.2555,22 38.8125,22 Z"/> + <path style="opacity:0.2;fill:#ffffff" d="M 12.75 4 C 11.2265 4 10 5.2495812 10 6.8007812 L 10 7.8007812 C 10 6.2495813 11.2265 5 12.75 5 L 36 5 L 36 4 L 12.75 4 z"/> + <path style="opacity:0.2" d="M 21,33 V 50 H 43 V 33 Z m 2,2 h 8 v 3 h -8 z m 10,0 h 8 v 3 h -8 z m -10,5 h 8 v 3 h -8 z m 10,0 h 8 v 3 h -8 z m -10,5 h 8 v 3 h -8 z m 10,0 h 8 v 3 h -8 z"/> + <path style="fill:#ffffff" d="M 21,32 V 49 H 43 V 32 Z m 2,2 h 8 v 3 h -8 z m 10,0 h 8 v 3 h -8 z m -10,5 h 8 v 3 h -8 z m 10,0 h 8 v 3 h -8 z m -10,5 h 8 v 3 h -8 z m 10,0 h 8 v 3 h -8 z"/> +</svg> diff --git a/Ccs/plotter.py b/Ccs/plotter.py index 717f9eb..8878352 100644 --- a/Ccs/plotter.py +++ b/Ccs/plotter.py @@ -229,6 +229,7 @@ class PlotViewer(Gtk.Window): def create_canvas(self): fig = Figure() + fig.set_tight_layout(True) self.subplot = fig.add_subplot(111) self.subplot.grid() self.subplot.set_xlabel('CUC time [s]') @@ -313,12 +314,12 @@ class PlotViewer(Gtk.Window): hbox = Gtk.HBox(homogeneous=True) data_button = Gtk.Button(label='View plot data') - data_button.set_image(Gtk.Image.new_from_icon_name('gtk-justify-fill', Gtk.IconSize.BUTTON)) + data_button.set_image(Gtk.Image.new_from_icon_name('format-justify-fill', Gtk.IconSize.BUTTON)) data_button.set_always_show_image(True) data_button.connect('clicked', self.show_plot_data) save_button = Gtk.Button(label='Save plot data') - save_button.set_image(Gtk.Image.new_from_icon_name('gtk-save', Gtk.IconSize.BUTTON)) + save_button.set_image(Gtk.Image.new_from_icon_name('document-save', Gtk.IconSize.BUTTON)) save_button.set_always_show_image(True) save_button.connect('clicked', self.save_plot_data) @@ -329,7 +330,7 @@ class PlotViewer(Gtk.Window): add_userpar_butt = Gtk.Button(label='Add User Defined Parameter') add_userpar_butt.connect('clicked', self.add_user_parameter, self.treeview) edit_userpar_butt = Gtk.Button() - edit_userpar_butt.set_image(Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.BUTTON)) + edit_userpar_butt.set_image(Gtk.Image.new_from_icon_name('edit', Gtk.IconSize.BUTTON)) edit_userpar_butt.connect('clicked', self.edit_user_parameter, self.treeview) edit_userpar_butt.set_tooltip_text('Edit user defined parameter') rm_userpar_butt = Gtk.Button() diff --git a/Ccs/poolview_sql.py b/Ccs/poolview_sql.py index 3a966f4..1b3481b 100644 --- a/Ccs/poolview_sql.py +++ b/Ccs/poolview_sql.py @@ -1139,32 +1139,52 @@ class TMPoolView(Gtk.Window): self.mon_butt.connect('clicked', self.monitor_parameters) self.mon_butt.connect('button-press-event', self.show_context_menu, self.context_menu()) - dump_butt = Gtk.Button.new_from_icon_name('gtk-save', Gtk.IconSize.LARGE_TOOLBAR) + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/document-save.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + dump_butt = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf)) dump_butt.set_tooltip_text('Save pool') dump_butt.connect('clicked', self.save_pool) - load_butt = Gtk.Button.new_from_icon_name('gtk-open', Gtk.IconSize.LARGE_TOOLBAR) + + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/document-open-folder.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + load_butt = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf)) load_butt.set_tooltip_text('Load pool') load_butt.connect('clicked', self.load_pool) - extract_butt = Gtk.Button.new_from_icon_name('gtk-paste', Gtk.IconSize.LARGE_TOOLBAR) + + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/edit-paste.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + extract_butt = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf)) extract_butt.set_tooltip_text('Extract packets') extract_butt.connect('clicked', self.collect_packet_data) # live buttons - self.rec_butt = Gtk.Button(image=Gtk.Image.new_from_icon_name('gtk-media-record', Gtk.IconSize.LARGE_TOOLBAR), + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/media-record.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + self.rec_butt = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf), tooltip_text='Manage recording to LIVE pool') + + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/func.png') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) self.rec_butt.connect('clicked', self.start_recording) - self.stop_butt = Gtk.Button(image=Gtk.Image.new_from_icon_name('gtk-media-stop', Gtk.IconSize.LARGE_TOOLBAR), + + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/media-playback-stop.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + self.stop_butt = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf), tooltip_text='Stop recording to currently selected LIVE pool') self.stop_butt.set_sensitive(False) self.stop_butt.connect('clicked', self.stop_recording) - clear_butt = Gtk.Button.new_from_icon_name('edit-clear', Gtk.IconSize.LARGE_TOOLBAR) + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/edit-clear.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + clear_butt = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf)) clear_butt.set_tooltip_text('Clear current pool') clear_butt.connect('clicked', self.clear_pool) self.univie_box = self.create_univie_box() - bigd = Gtk.Button.new_from_icon_name('gtk-justify-fill', Gtk.IconSize.LARGE_TOOLBAR) + icon_path = os.path.join(self.cfg.get('paths', 'ccs'), 'pixmap/format-justify-fill.svg') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 24, 24) + bigd = Gtk.Button(image=Gtk.Image.new_from_pixbuf(pixbuf)) bigd.set_tooltip_text('Open Large Data Viewer') bigd.connect('clicked', self.show_bigdata) diff --git a/Tst/tst/tst.py b/Tst/tst/tst.py index c57f5b8..1410cdf 100755 --- a/Tst/tst/tst.py +++ b/Tst/tst/tst.py @@ -279,7 +279,10 @@ class TstAppWindow(Gtk.ApplicationWindow): # self.btn_show_model_viewer.connect('clicked', self.model_viewer_toggle_hide) self.btn_export_csv = Gtk.ToolButton() self.btn_export_csv.set_label('Export to CSV') - self.btn_export_csv.set_icon_name('text-csv') + # self.btn_export_csv.set_icon_name('text-csv') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.join(cfg.get('paths', 'ccs'), 'pixmap/x-office-spreadsheet.svg'), 28, 28) + icon = Gtk.Image.new_from_pixbuf(pixbuf) + self.btn_export_csv.set_icon_widget(icon) self.btn_export_csv.set_tooltip_text('Export current spec to CSV') self.btn_export_csv.connect('clicked', self.on_generate_csv) self.btn_generate_products = Gtk.ToolButton() @@ -291,7 +294,10 @@ class TstAppWindow(Gtk.ApplicationWindow): self.btn_generate_products.connect('clicked', self.on_generate_products) self.btn_generate_script = Gtk.ToolButton() self.btn_generate_script.set_label('Generate script') - self.btn_generate_script.set_icon_name('text-x-python') + # self.btn_generate_script.set_icon_name('text-x-python') + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.join(cfg.get('paths', 'ccs'), 'pixmap/text-x-python.svg'), 28, 28) + icon = Gtk.Image.new_from_pixbuf(pixbuf) + self.btn_generate_script.set_icon_widget(icon) self.btn_generate_script.set_tooltip_text('Generate compact Python script of the current test') self.btn_generate_script.connect('clicked', self.on_generate_barescript) -- GitLab