Clean ZAZFavorites

This commit is contained in:
Mauricio Baeza 2020-12-24 21:52:58 -06:00
parent a5b1eeb831
commit 705af2ea73
3 changed files with 28 additions and 44 deletions

Binary file not shown.

View File

@ -18,48 +18,6 @@ class ZAZFavorites(unohelper.Base, XJobExecutor):
main.run(args, __file__)
return
def _create_dialog(self):
columns = (
{'Title': _('File Name'), 'MaxWidth': 120},
{'Title': 'X', 'HorizontalAlign': 1, 'Resizeable': False, 'ColumnWidth': 10},
{'Title': '', 'Resizeable': False, 'ColumnWidth': 0},
)
args = {
'Type': 'Grid',
'Name': 'grid',
'Width': 140,
'Height': 110,
'ShowRowHeader': True,
'Columns': columns
}
dlg.add_control(args)
dlg.grid.set_column_image(1, app.join(self.IMAGES, 'delete.png'))
paths = app.get_config('paths', [])
for path in paths:
p, filename, n, e = app.get_info_path(path)
dlg.grid.add_row((filename, '', path))
dlg.grid.set_cell_tooltip(0, dlg.grid.rows-1, p)
dlg.events.paths = paths
args = {
'Type': 'Button',
'Name': 'button_save',
'Label': _('~Save'),
'ImageURL': app.join(self.IMAGES, 'save.png'),
'ImagePosition': 1,
'Width': 60,
'Height': 15,
}
dlg.add_control(args)
dlg.button_add.center()
dlg.grid.move(dlg.button_add)
dlg.grid.center()
dlg.button_save.move(dlg.grid)
dlg.button_save.center()
return dlg
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(ZAZFavorites, ID_EXTENSION, SERVICE)

View File

@ -94,6 +94,15 @@ class Controllers(object):
def _config():
dlg = _create_dialog()
# ~ dlg.grid.set_column_image(1, app.join(self.IMAGES, 'delete.png'))
# ~ paths = app.get_config('paths', [])
# ~ for path in paths:
# ~ p, filename, n, e = app.get_info_path(path)
# ~ dlg.grid.add_row((filename, '', path))
# ~ dlg.grid.set_cell_tooltip(0, dlg.grid.rows-1, p)
# ~ dlg.events.paths = paths
dlg.open()
return
@ -105,7 +114,7 @@ def _create_dialog():
'Name': 'dialog',
'Title': TITLE,
'Width': 160,
'Height': 160,
'Height': 170,
}
dlg = app.create_dialog(args)
dlg.id = ID_EXTENSION
@ -123,6 +132,21 @@ def _create_dialog():
}
dlg.add_control(args)
columns = (
{'Title': _('File Name'), 'MaxWidth': 120},
{'Title': 'X', 'HorizontalAlign': 1, 'Resizeable': False, 'ColumnWidth': 10},
{'Title': '', 'Resizeable': False, 'ColumnWidth': 0},
)
args = {
'Type': 'Grid',
'Name': 'grid',
'Width': 140,
'Height': 110,
'ShowRowHeader': True,
}
grid = dlg.add_control(args)
grid.columns = columns
args = {
'Type': 'Button',
'Name': 'button_save',
@ -135,7 +159,9 @@ def _create_dialog():
dlg.add_control(args)
dlg.button_add.center()
dlg.button_save.move(dlg.button_add)
dlg.grid.move(dlg.button_add)
dlg.button_save.move(dlg.grid)
dlg.grid.center()
dlg.button_save.center()
return dlg