From c9f12060d57db5bf8024884a4bd6b83aeb9b151c Mon Sep 17 00:00:00 2001 From: saddy001 Date: Tue, 17 Apr 2018 08:01:35 +0200 Subject: [PATCH 01/11] Update gui.py allow treeopen keyword for TreeItem --- remi/gui.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/remi/gui.py b/remi/gui.py index e83108d3..eae44cfa 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -2733,8 +2733,9 @@ def __init__(self, text, **kwargs): "sendCallback('%s','%s');" \ "event.stopPropagation();event.preventDefault();" % (self.identifier, self.EVENT_ONCLICK) self.set_text(text) - self.treeopen = False - self.attributes['treeopen'] = 'false' + treeopen = kwargs.get('treeopen', False) + self.treeopen = treeopen + self.attributes['treeopen'] = str(treeopen).lower() self.attributes['has-subtree'] = 'false' def append(self, value, key=''): From 010ff9bae890333bdde2ed866f08dd9b6fc85a40 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Wed, 18 Apr 2018 12:51:14 +0200 Subject: [PATCH 02/11] text_align keyword for TableEditableItem add text_align keyword to TableEditableItem --- remi/gui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remi/gui.py b/remi/gui.py index eae44cfa..a910d73f 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -2119,7 +2119,7 @@ class TableEditableItem(Widget, _MixinTextualWidget): """item widget for the TableRow.""" @decorate_constructor_parameter_types([str]) - def __init__(self, text='', **kwargs): + def __init__(self, text='', text_align='left' **kwargs): """ Args: text (str): @@ -2127,7 +2127,7 @@ def __init__(self, text='', **kwargs): """ super(TableEditableItem, self).__init__(**kwargs) self.type = 'td' - self.editInput = TextInput() + self.editInput = TextInput(style={'text-align': text_align}) self.append(self.editInput) self.editInput.set_on_change_listener(self.onchange) self.get_text = self.editInput.get_text From 96abbdf2c796ebf44744b2066d33c5dad072e44b Mon Sep 17 00:00:00 2001 From: saddy001 Date: Wed, 18 Apr 2018 12:55:21 +0200 Subject: [PATCH 03/11] text_align keyword for TableEditableItem add text_align keyword to TableEditableItem --- remi/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remi/gui.py b/remi/gui.py index a910d73f..477e36b2 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -2119,7 +2119,7 @@ class TableEditableItem(Widget, _MixinTextualWidget): """item widget for the TableRow.""" @decorate_constructor_parameter_types([str]) - def __init__(self, text='', text_align='left' **kwargs): + def __init__(self, text='', text_align='left', **kwargs): """ Args: text (str): From 379d8405c72cbc0e6a65d9bbb71d9edb321963f4 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Thu, 19 Apr 2018 10:46:57 +0200 Subject: [PATCH 04/11] add text_style for TableEditableItem --- remi/gui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remi/gui.py b/remi/gui.py index 477e36b2..d1637b87 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -2119,7 +2119,7 @@ class TableEditableItem(Widget, _MixinTextualWidget): """item widget for the TableRow.""" @decorate_constructor_parameter_types([str]) - def __init__(self, text='', text_align='left', **kwargs): + def __init__(self, text='', text_style={}, **kwargs): """ Args: text (str): @@ -2127,7 +2127,7 @@ def __init__(self, text='', text_align='left', **kwargs): """ super(TableEditableItem, self).__init__(**kwargs) self.type = 'td' - self.editInput = TextInput(style={'text-align': text_align}) + self.editInput = TextInput(style=text_style) self.append(self.editInput) self.editInput.set_on_change_listener(self.onchange) self.get_text = self.editInput.get_text From 3c5cb9402af583b89771bc31f226feb938082f23 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Thu, 19 Apr 2018 11:17:25 +0200 Subject: [PATCH 05/11] tree_open as explicit keyword on TreeItem --- remi/gui.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/remi/gui.py b/remi/gui.py index d1637b87..97d165a0 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -2720,7 +2720,7 @@ class TreeItem(Widget, _MixinTextualWidget): """TreeItem widget can contain other TreeItem.""" @decorate_constructor_parameter_types([str]) - def __init__(self, text, **kwargs): + def __init__(self, text, tree_open=False, **kwargs): """ Args: text (str): @@ -2733,9 +2733,8 @@ def __init__(self, text, **kwargs): "sendCallback('%s','%s');" \ "event.stopPropagation();event.preventDefault();" % (self.identifier, self.EVENT_ONCLICK) self.set_text(text) - treeopen = kwargs.get('treeopen', False) - self.treeopen = treeopen - self.attributes['treeopen'] = str(treeopen).lower() + self.treeopen = tree_open + self.attributes['treeopen'] = str(tree_open).lower() self.attributes['has-subtree'] = 'false' def append(self, value, key=''): From ec643204995bd47d603453e59cbfe22f639744f3 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Fri, 20 Apr 2018 11:28:08 +0200 Subject: [PATCH 06/11] margin overrides margin-left/top etc. Prevent margin-x overrides by setting kwarg margin=None --- remi/gui.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/remi/gui.py b/remi/gui.py index 97d165a0..843344f9 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -373,7 +373,7 @@ class Widget(Tag): EVENT_ONUPDATE = 'onupdate' @decorate_constructor_parameter_types([]) - def __init__(self, **kwargs): + def __init__(self, margin='0px', **kwargs): """ Args: width (int, str): An optional width for the widget (es. width=10 or width='10px' or width='10%'). @@ -390,7 +390,9 @@ def __init__(self, **kwargs): self.eventManager = _EventManager(self) self.oldRootWidget = None # used when hiding the widget - self.style['margin'] = kwargs.get('margin', '0px') + if margin: + self.style['margin'] = margin + self.set_layout_orientation(kwargs.get('layout_orientation', Widget.LAYOUT_VERTICAL)) self.set_size(kwargs.get('width'), kwargs.get('height')) self.set_style(kwargs.pop('style', None)) From b7778af26231c99d62de15148b22e6ce9688cda1 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Thu, 3 May 2018 14:50:48 +0200 Subject: [PATCH 07/11] allow hint kwarg also for TableEditableItem (#1) --- remi/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remi/gui.py b/remi/gui.py index 843344f9..b87555d7 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -2129,7 +2129,7 @@ def __init__(self, text='', text_style={}, **kwargs): """ super(TableEditableItem, self).__init__(**kwargs) self.type = 'td' - self.editInput = TextInput(style=text_style) + self.editInput = TextInput(style=text_style, **kwargs) self.append(self.editInput) self.editInput.set_on_change_listener(self.onchange) self.get_text = self.editInput.get_text From 9ab13899b4be14d2d112790bd9ad9d7ffbd6078a Mon Sep 17 00:00:00 2001 From: saddy001 Date: Tue, 15 May 2018 07:58:10 +0200 Subject: [PATCH 08/11] Update gui.py --- remi/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remi/gui.py b/remi/gui.py index b87555d7..027a4325 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -1317,7 +1317,7 @@ def __init__(self, title='', message='', **kwargs): """ super(GenericDialog, self).__init__(**kwargs) self.set_layout_orientation(Widget.LAYOUT_VERTICAL) - self.style.update({'display':'block', 'overflow':'auto', 'margin':'0px auto'}) + self.style.update({'display':'block', 'overflow':'auto', 'margin':'8px auto'}) if len(title) > 0: t = Label(title) From fccb0f79416480a42c4c526b7eb86a7242ccbd7f Mon Sep 17 00:00:00 2001 From: saddy001 Date: Tue, 15 May 2018 08:03:11 +0200 Subject: [PATCH 09/11] Update gui.py --- remi/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remi/gui.py b/remi/gui.py index 027a4325..eee2febe 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -1317,7 +1317,7 @@ def __init__(self, title='', message='', **kwargs): """ super(GenericDialog, self).__init__(**kwargs) self.set_layout_orientation(Widget.LAYOUT_VERTICAL) - self.style.update({'display':'block', 'overflow':'auto', 'margin':'8px auto'}) + self.style.update({'display':'block', 'overflow':'auto', 'margin':'8px auto', 'padding': '8px'}) if len(title) > 0: t = Label(title) From 871b5d015252ff06de2f79f45b14bd30d8121ec1 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Tue, 15 May 2018 09:29:00 +0200 Subject: [PATCH 10/11] Add cancel_button kwarg for GenericDialog --- remi/gui.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/remi/gui.py b/remi/gui.py index eee2febe..f1e9587f 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -1308,7 +1308,7 @@ class GenericDialog(Widget): EVENT_ONCANCEL = 'cancel_dialog' @decorate_constructor_parameter_types([str, str]) - def __init__(self, title='', message='', **kwargs): + def __init__(self, title='', message='', cancel_button=True, **kwargs): """ Args: title (str): The title of the dialog. @@ -1335,22 +1335,25 @@ def __init__(self, title='', message='', **kwargs): self.conf = Button('Ok') self.conf.set_size(100, 30) self.conf.style['margin'] = '3px' - self.cancel = Button('Cancel') - self.cancel.set_size(100, 30) - self.cancel.style['margin'] = '3px' hlay = Widget(height=35) hlay.style['display'] = 'block' hlay.style['overflow'] = 'visible' hlay.append(self.conf) - hlay.append(self.cancel) self.conf.style['float'] = 'right' - self.cancel.style['float'] = 'right' + + if cancel_button: + self.cancel = Button('Cancel') + self.cancel.set_size(100, 30) + self.cancel.style['margin'] = '3px' + self.cancel.style['float'] = 'right' + self.cancel.attributes[self.EVENT_ONCLICK] = "sendCallback('%s','%s');" % ( + self.identifier, self.EVENT_ONCANCEL) + hlay.append(self.cancel) self.append(self.container) self.append(hlay) self.conf.attributes[self.EVENT_ONCLICK] = "sendCallback('%s','%s');" % (self.identifier, self.EVENT_ONCONFIRM) - self.cancel.attributes[self.EVENT_ONCLICK] = "sendCallback('%s','%s');" % (self.identifier, self.EVENT_ONCANCEL) self.inputs = {} From 1dd886a55b0d2750880253508df43c90db4f0b08 Mon Sep 17 00:00:00 2001 From: saddy001 Date: Mon, 28 May 2018 17:24:57 +0200 Subject: [PATCH 11/11] Allow tooltip_title for ListItem --- remi/gui.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/remi/gui.py b/remi/gui.py index f1e9587f..301d7f9e 100644 --- a/remi/gui.py +++ b/remi/gui.py @@ -1672,7 +1672,7 @@ class ListItem(Widget, _MixinTextualWidget): """ @decorate_constructor_parameter_types([str]) - def __init__(self, text, **kwargs): + def __init__(self, text, tooltip_title='', **kwargs): """ Args: text (str, unicode): The textual content of the ListItem. @@ -1682,6 +1682,10 @@ def __init__(self, text, **kwargs): self.type = 'li' self.attributes[self.EVENT_ONCLICK] = '' + + if tooltip_title: + self.attributes['title'] = tooltip_title + self.set_text(text) def get_value(self):