diff --git a/MiAZ/frontend/desktop/app.py b/MiAZ/frontend/desktop/app.py
index f0b0535c..922aabe6 100644
--- a/MiAZ/frontend/desktop/app.py
+++ b/MiAZ/frontend/desktop/app.py
@@ -74,8 +74,11 @@ def _on_activate(self, app):
self.win.set_default_icon_name('MiAZ')
self.theme = self.add_service('theme', Gtk.IconTheme.get_for_display(self.win.get_display()))
self.theme.add_search_path(ENV['GPATH']['ICONS'])
+ self.log.debug("Setting up Widget Factory")
self.factory = self.add_service('factory', MiAZFactory(self))
+ self.log.debug("Setting up MiAZ Actions")
self.actions = self.add_service('actions', MiAZActions(self))
+ self.log.debug("Setting up Widget GUI")
self._setup_gui()
self._setup_event_listener()
self._setup_plugin_manager()
@@ -91,11 +94,10 @@ def _on_window_close_request(self, window):
def _update_repo_settings(self, *args):
self.log.debug("Repo switched. Configuration switched")
widget_settings_repo = self.get_widget('settings-repo')
- # ~ label_repo = self.get_widget('label_repo')
if widget_settings_repo is not None:
self.stack.remove(widget_settings_repo)
self.remove_widget('settings-repo')
- # ~ self._setup_page_repo_settings()
+ # ~ #self._setup_page_repo_settings()
repo_active = self.conf['App'].get('current')
# ~ label_repo.set_markup(' [%s] ' % repo_active.replace('_', ' '))
@@ -313,20 +315,21 @@ def show_repo_settings(self, *args):
def show_app_about(self, *args):
self.show_stack_page_by_name('about')
+ self.message('About MiAZ app')
def show_workspace(self, *args):
self.show_stack_page_by_name('workspace')
- def _setup_headerbar_left_menu(self):
- # System menu
- hbox = self.factory.create_box_horizontal(margin=0, spacing=0)
- hbox.get_style_context().add_class(class_name='linked')
- menubutton = self.get_widget('headerbar-button-menu-system')
- menubutton.get_style_context().add_class(class_name='flat')
- menubutton.set_valign(Gtk.Align.CENTER)
- hbox.append(menubutton)
- headerbar = self.get_widget('headerbar')
- headerbar.pack_start(hbox)
+ # ~ def _setup_headerbar_left_menu(self):
+ # ~ # System menu
+ # ~ hbox = self.factory.create_box_horizontal(margin=0, spacing=0)
+ # ~ hbox.get_style_context().add_class(class_name='linked')
+ # ~ menubutton = self.get_widget('headerbar-button-menu-system')
+ # ~ menubutton.get_style_context().add_class(class_name='flat')
+ # ~ menubutton.set_valign(Gtk.Align.CENTER)
+ # ~ hbox.append(menubutton)
+ # ~ headerbar = self.get_widget('headerbar')
+ # ~ headerbar.pack_start(hbox)
def _setup_headerbar_left(self):
# System menu
@@ -357,24 +360,33 @@ def _setup_headerbar_center(self):
def _setup_gui(self):
# Widgets
## HeaderBar
+ self.log.debug("Setting up HeaderBar")
headerbar = self.add_widget('headerbar', Gtk.HeaderBar())
self.win.set_titlebar(headerbar)
## Central Box
+ self.log.debug("Setting up the main box")
self.mainbox = self.factory.create_box_vertical(vexpand=True)
self.win.set_child(self.mainbox)
## Stack & Stack.Switcher
+ self.log.debug("Setting up stack")
stack = self._setup_stack()
self.mainbox.append(stack)
# Setup system menu
+ self.log.debug("Setting up menues")
self._setup_menu_app()
- # Setup headerbar
- self._setup_headerbar_left_menu()
+ # Setup headerbar widgets
+ self.log.debug("Setting up headerbar")
+ self.log.debug("\tmenu")
+ # ~ self._setup_headerbar_left_menu()
+ self.log.debug("\tleft")
self._setup_headerbar_left()
+ self.log.debug("\tcenter")
self._setup_headerbar_center()
+ self.log.debug("\tright")
self._setup_headerbar_right()
# Create system pages
@@ -383,6 +395,7 @@ def _setup_gui(self):
self._setup_page_help()
# Statusbar
+ self.log.debug("Setting up Statusbar")
statusbar = self.add_widget('statusbar', MiAZStatusbar(self))
self.mainbox.append(statusbar)
@@ -393,14 +406,22 @@ def check_repository(self):
self.log.debug("Repo? '%s'", dir_repo)
if self.backend.repo_validate(dir_repo):
self.backend.repo_load(dir_repo)
+ self.log.debug("Setting up workspace")
if self.get_widget('workspace') is None:
self._setup_page_workspace()
if not self.plugins_loaded:
+ self.log.debug("Rloading plugins")
self.load_plugins()
+ self.log.debug("Setting up Rename widget")
if self.get_widget('rename') is None:
self._setup_page_rename()
+ self.log.debug("Setting up Repository settings widget")
if self.get_widget('settings-repo') is None:
self._setup_page_repo_settings()
+
+ workspace = self.get_widget('workspace')
+ workspace.initialize_caches()
+
self.show_stack_page_by_name('workspace')
valid = True
statusbar = self.get_widget('statusbar')
@@ -512,3 +533,7 @@ def remove_widget(self, name: str):
self.log.error("Widget '%s' doesn't exists", name)
return deleted
+ def message(self, message: str):
+ """Statusbar message"""
+ statusbar = self.get_widget('statusbar')
+ statusbar.message(message)
diff --git a/MiAZ/frontend/desktop/factory.py b/MiAZ/frontend/desktop/factory.py
index bc364740..298b39d7 100644
--- a/MiAZ/frontend/desktop/factory.py
+++ b/MiAZ/frontend/desktop/factory.py
@@ -118,10 +118,11 @@ def create_button_content(self, icon_name='', title='', callback=None, width=16,
return hbox
- def create_button(self, icon_name='', title='', callback=None, width=16, height=16, css_classes=[], data=None):
+ def create_button(self, icon_name='', title='', tooltip='', callback=None, width=16, height=16, css_classes=[], data=None):
button = Gtk.Button(css_classes=css_classes)
+
# ~ button.get_style_context().add_class(class_name='flat')
- hbox = self.create_box_horizontal()
+ hbox = self.create_box_horizontal(spacing=0, margin=0)
if len(icon_name.strip()) > 0:
icon = self.icons.get_image_by_name(icon_name)
icon.set_pixel_size(width)
@@ -134,6 +135,9 @@ def create_button(self, icon_name='', title='', callback=None, width=16, height=
label.set_valign(Gtk.Align.CENTER)
hbox.append(label)
+ if len(tooltip) > 0:
+ button.set_tooltip_markup(tooltip)
+
button.set_child(hbox)
if callback is not None:
@@ -143,7 +147,7 @@ def create_button(self, icon_name='', title='', callback=None, width=16, height=
def create_button_toggle(self, icon_name: str = '', title: str = '', callback=None, css_classes=[], data=None) -> Gtk.ToggleButton:
button = Gtk.ToggleButton(css_classes=css_classes)
- hbox = self.create_box_horizontal()
+ hbox = self.create_box_horizontal(spacing=0, margin=0)
if len(icon_name.strip()) == 0:
icon = Gtk.Image()
else:
diff --git a/MiAZ/frontend/desktop/widgets/configview.py b/MiAZ/frontend/desktop/widgets/configview.py
index af130950..06ba5cbf 100644
--- a/MiAZ/frontend/desktop/widgets/configview.py
+++ b/MiAZ/frontend/desktop/widgets/configview.py
@@ -55,6 +55,8 @@ def _setup_view(self):
frmView.set_child(self.view)
return selector
+ def _on_config_import(self, *args):
+ self.log.debug("Import configuration for '%s'", self.config.config_for)
class MiAZRepositories(MiAZConfigView):
"""Manage Repositories"""
diff --git a/MiAZ/frontend/desktop/widgets/rename.py b/MiAZ/frontend/desktop/widgets/rename.py
index 716bb237..14ac8465 100644
--- a/MiAZ/frontend/desktop/widgets/rename.py
+++ b/MiAZ/frontend/desktop/widgets/rename.py
@@ -67,14 +67,14 @@ def __init__(self, app) -> Gtk.Widget:
frmMain.set_child(self.boxMain)
self.append(frmMain)
- self.btnAccept = self.factory.create_button('miaz-ok', _('Rename'), self.on_rename_accept, css_classes=['opaque'])
+ self.btnAccept = self.factory.create_button(icon_name='miaz-ok', title=_('Rename'), callback=self.on_rename_accept, css_classes=['opaque'])
self.btnAccept.set_sensitive(True)
# ~ self.btnAccept.get_style_context ().add_class('suggested-action')
self.btnAccept.set_can_focus(True)
self.btnAccept.set_focusable(True)
self.btnAccept.set_receives_default(True)
- self.btnCancel = self.factory.create_button('miaz-cancel', _('Cancel'), self.on_rename_cancel)
+ self.btnCancel = self.factory.create_button(icon_name='miaz-cancel', title=_('Cancel'), callback=self.on_rename_cancel)
# ~ self.btnCancel.get_style_context ().add_class ('destructive-action')
self.btnPreview = self.factory.create_button('miaz-preview', _('Preview'))
self.btnPreview.connect('clicked', self._on_document_display)
@@ -188,6 +188,7 @@ def __create_field_0_date(self):
self.label_date = Gtk.Label()
self.label_date.get_style_context().add_class(class_name='caption')
self.entry_date = Gtk.Entry()
+ self.entry_date.set_visible(False)
self.entry_date.set_max_length(8)
self.entry_date.set_max_width_chars(8)
self.entry_date.set_width_chars(8)
@@ -242,7 +243,7 @@ def __create_field_6_concept(self):
button.set_has_frame(False)
self.entry_concept = Gtk.Entry()
self.entry_concept.set_width_chars(41)
- self.entry_concept.set_alignment(1.0)
+ # ~ self.entry_concept.set_alignment(1.0)
self.entry_concept.set_placeholder_text(_('Type anything here...'))
boxValue.append(self.entry_concept)
boxValue.append(button)
diff --git a/MiAZ/frontend/desktop/widgets/selector.py b/MiAZ/frontend/desktop/widgets/selector.py
index 8d86a44a..1741b21d 100644
--- a/MiAZ/frontend/desktop/widgets/selector.py
+++ b/MiAZ/frontend/desktop/widgets/selector.py
@@ -41,6 +41,7 @@ def __init__(self, app, edit=True):
self.boxOper.set_margin_bottom(6)
self.boxOper.set_margin_start(0)
self.boxOper.set_margin_end(0)
+ self.boxOper.set_hexpand(True)
self.boxOper.set_vexpand(False)
boxEntry = Gtk.Box(spacing=0, orientation=Gtk.Orientation.HORIZONTAL)
boxEntry.set_hexpand(False)
@@ -56,10 +57,12 @@ def __init__(self, app, edit=True):
boxEntry.append(self.entry)
self.boxOper.append(boxEntry)
if edit:
- self.boxButtons = Gtk.Box(spacing=3, orientation=Gtk.Orientation.HORIZONTAL)
- self.boxButtons.set_hexpand(False)
+ self.boxButtons = Gtk.Box(spacing=0, orientation=Gtk.Orientation.HORIZONTAL)
+ self.boxButtons.get_style_context().add_class(class_name='linked')
+ self.boxButtons.set_hexpand(True)
self.boxButtons.append(self.factory.create_button(icon_name='miaz-list-add', title='', callback=self.on_item_available_add, data=self.config_for))
self.boxButtons.append(self.factory.create_button(icon_name='miaz-list-remove', title='', callback=self._on_item_available_remove))
+ self.boxButtons.append(self.factory.create_button(icon_name='miaz-import-config', tooltip='Import configuration', callback=self._on_config_import))
self.boxOper.append(self.boxButtons)
self.append(self.boxOper)
boxViews = self.factory.create_box_horizontal(spacing=0, hexpand=True, vexpand=True)
@@ -274,5 +277,9 @@ def _do_filter_view(self, item, filter_list_model):
def _on_entrysearch_delete(self, *args):
self.entry.set_text("")
+
+ def _on_config_import(self, *args):
+ pass
+
def get_search_entry(self):
return self.entry
diff --git a/MiAZ/frontend/desktop/widgets/statusbar.py b/MiAZ/frontend/desktop/widgets/statusbar.py
index a1d90567..4bcd771f 100644
--- a/MiAZ/frontend/desktop/widgets/statusbar.py
+++ b/MiAZ/frontend/desktop/widgets/statusbar.py
@@ -20,6 +20,11 @@ def __init__(self, app):
self.set_margin_bottom(margin=6)
self.set_margin_start(margin=6)
self.set_margin_end(margin=6)
+ self.get_style_context().add_class(class_name='linked')
+ self.get_style_context().add_class(class_name='osd')
+ self.get_style_context().add_class(class_name='monospace')
+ self.get_style_context().add_class(class_name='toolbar')
+ self.get_style_context().add_class(class_name='linked')
# Separator
# ~ separator = Gtk.Separator.new(orientation=Gtk.Orientation.HORIZONTAL)
diff --git a/MiAZ/frontend/desktop/widgets/views.py b/MiAZ/frontend/desktop/widgets/views.py
index c63f06c8..4e9e5ff2 100644
--- a/MiAZ/frontend/desktop/widgets/views.py
+++ b/MiAZ/frontend/desktop/widgets/views.py
@@ -168,7 +168,7 @@ def _on_factory_bind_icon_type(self, factory, list_item):
mimetype, val = Gio.content_type_guess('filename=%s' % item.id)
gicon = self.srvicm.get_mimetype_icon(mimetype)
icon.set_from_gicon(gicon)
- icon.set_pixel_size(24)
+ icon.set_pixel_size(48)
def _on_factory_setup_country(self, factory, list_item):
box = ColLabel()
@@ -244,12 +244,13 @@ def _on_factory_setup_flag(self, factory, list_item):
def _on_factory_bind_flag(self, factory, list_item):
box = list_item.get_child()
+ box.set_halign(Gtk.Align.CENTER)
item = list_item.get_item()
icon = box.get_first_child()
code = item.country
paintable = self.srvicm.get_flag_icon(code)
icon.set_from_paintable(paintable)
- icon.set_pixel_size(24)
+ icon.set_pixel_size(48)
def _on_factory_setup_flag(self, factory, list_item):
box = ColIcon()
diff --git a/MiAZ/frontend/desktop/widgets/workspace.py b/MiAZ/frontend/desktop/widgets/workspace.py
index 96be0d5f..368c267d 100644
--- a/MiAZ/frontend/desktop/widgets/workspace.py
+++ b/MiAZ/frontend/desktop/widgets/workspace.py
@@ -96,7 +96,7 @@ def __init__(self, app):
self.cache = self.util.json_load(self.fcache)
self.log.debug("Loading cache from %s", self.fcache)
except:
- self._initialize_caches()
+ self.initialize_caches()
self._check_first_time()
@@ -104,7 +104,7 @@ def __init__(self, app):
self.app.connect('start-application-completed', self._finish_configuration)
self._on_filter_selected()
- def _initialize_caches(self):
+ def initialize_caches(self):
self.cache = {}
for cache in ['Date', 'Country', 'Group', 'SentBy', 'SentTo', 'Purpose']:
self.cache[cache] = {}
@@ -127,7 +127,8 @@ def _on_config_used_updated(self, *args):
# FIXME
# Right now, there is no way to know which config item has been
# updated, therefore, the whole cache must be invalidated :/
- self._initialize_caches()
+ self.initialize_caches()
+ self.update()
# ~ self.log.debug("Config changed")
def _on_filename_renamed(self, util, source, target):
@@ -210,6 +211,7 @@ def _on_selection_changed(self, selection, position, n_items):
label = self.btnDocsSel.get_child()
docs = self.util.get_files()
label.set_markup("%d / %d / %d" % (len(self.selected_items), len(model), len(docs)))
+ self.app.message("Selected %d of %d documents in current view (total documents: %d)" % (len(self.selected_items), len(model), len(docs)))
# ~ if len(self.selected_items) == 1:
# ~ menu = self.app.get_widget('workspace-menu-single')
# ~ self.popDocsSel.set_menu_model(menu)
@@ -262,6 +264,22 @@ def _setup_toolbar_top(self):
hdb_left.append(dd_prj)
self.app.set_widget('ws-dropdowns', dropdowns)
+ # Menu Single and Multiple
+ popovermenu = self._setup_menu_selection()
+ label = Gtk.Label()
+ self.btnDocsSel = Gtk.MenuButton()
+ # ~ self.btnDocsSel.get_style_context().add_class(class_name='flat')
+ # ~ self.btnDocsSel.set_has_frame(False)
+ # ~ self.btnDocsSel.set_margin_start(24)
+ # ~ self.btnDocsSel.set_margin_end(24)
+ self.btnDocsSel.set_child(label)
+ self.popDocsSel = Gtk.PopoverMenu()
+ self.popDocsSel.set_menu_model(popovermenu)
+ self.btnDocsSel.set_popover(popover=self.popDocsSel)
+ self.btnDocsSel.set_sensitive(True)
+ # ~ headerbar = self.app.get_widget('headerbar')
+ hdb_right.append(self.btnDocsSel)
+
## Import button
widgets = []
btnImportFiles = self.factory.create_button('miaz-import-document', callback=self.actions.import_file)
@@ -277,16 +295,7 @@ def _setup_toolbar_top(self):
button = self.factory.create_button_popover(icon_name='miaz-list-add', title='', widgets=widgets)
hdb_right.append(button)
- # Menu Single and Multiple
- popovermenu = self._setup_menu_selection()
- label = Gtk.Label()
- self.btnDocsSel = Gtk.MenuButton()
- self.btnDocsSel.set_child(label)
- self.popDocsSel = Gtk.PopoverMenu()
- self.popDocsSel.set_menu_model(popovermenu)
- self.btnDocsSel.set_popover(popover=self.popDocsSel)
- self.btnDocsSel.set_sensitive(True)
- hdb_right.append(self.btnDocsSel)
+
def _update_dropdown_date(self):
dropdowns = self.app.get_widget('ws-dropdowns')
@@ -347,6 +356,7 @@ def _setup_columnview(self):
self.view = MiAZColumnViewWorkspace(self.app)
self.app.add_widget('workspace-view', self.view)
self.view.get_style_context().add_class(class_name='caption')
+ # ~ self.view.get_style_context().add_class(class_name='monospace')
self.view.set_filter(self._do_filter_view)
frmView = self.factory.create_frame(hexpand=True, vexpand=True)
frmView.set_child(self.view)
@@ -446,6 +456,7 @@ def clean_filters(self, *args):
def update(self, *args):
# FIXME: come up w/ a solution to display only available values
+ self.log.debug("Update requested")
dropdowns = self.app.get_widget('ws-dropdowns')
dd_date = dropdowns[Date.__gtype_name__]
dd_prj = dropdowns[Project.__gtype_name__]
@@ -471,16 +482,17 @@ def update(self, *args):
# ~ self.log.debug("Signal %d disconnected from Config '%s'", sigid, i_title)
keys_used = {}
- kf = [('Date', 0), ('Country', 1), ('Group', 2), ('SentBy', 3), ('Purpose', 4), ('Concept', 5), ('SentTo', 6)]
- for skey, nkey in kf:
- keys_used[skey] = set()
+ key_fields = [('Date', 0), ('Country', 1), ('Group', 2), ('SentBy', 3), ('Purpose', 4), ('Concept', 5), ('SentTo', 6)]
+ for skey, nkey in key_fields:
+ keys_used[skey] = set() # Avoid duplicates
+
for filename in docs:
active = True
doc, ext = self.util.filename_details(filename)
fields = doc.split('-')
if self.util.filename_validate(doc):
desc = {}
- for skey, nkey in kf:
+ for skey, nkey in key_fields:
key = fields[nkey]
# ~ self.log.debug("%s > %s", key, skey)
if nkey == 0:
@@ -582,7 +594,7 @@ def _do_eval_cond_matches(self, dropdown, id):
if len(id) == 0:
return True
else:
- return item.id == id
+ return item.id.upper() == id.upper()
def _do_eval_cond_matches_date(self, item):
# Convert timestamp to timedate object and cache it
diff --git a/data/com.github.t00m.MiAZ-symbolic.svg b/data/com.github.t00m.MiAZ-symbolic.svg
index 6d826294..0d6c3469 100644
--- a/data/com.github.t00m.MiAZ-symbolic.svg
+++ b/data/com.github.t00m.MiAZ-symbolic.svg
@@ -4,8 +4,8 @@
AZ
- Mi
+ x="58.387684"
+ y="75.370956"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:39.942px;line-height:1.25;font-family:Waree;-inkscape-font-specification:'Waree Bold';fill:#404040;stroke-width:3.32853">AZ
diff --git a/data/com.github.t00m.MiAZ.svg b/data/com.github.t00m.MiAZ.svg
index 6d826294..0d6c3469 100644
--- a/data/com.github.t00m.MiAZ.svg
+++ b/data/com.github.t00m.MiAZ.svg
@@ -4,8 +4,8 @@
AZ
- Mi
+ x="58.387684"
+ y="75.370956"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:39.942px;line-height:1.25;font-family:Waree;-inkscape-font-specification:'Waree Bold';fill:#404040;stroke-width:3.32853">AZ
diff --git a/meson.build b/meson.build
index 23c9999c..5f67e26d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('MiAZ',
- version: '0.0.22',
- meson_version: '>= 1.0.1',
+ version: '0.0.23',
+ meson_version: '>= 0.61.2',
default_options: [ 'warning_level=2',
],
)