Exemple #1
0
    def __init__(self, title='', message=''):
        super(ProjectConfigurationDialog, self).__init__(
            'Project Configuration',
            'Here are the configuration options of the project.',
            width=500)
        #standard configuration
        self.configDict = {}
        self.configDict['config_project_name'] = 'untitled'
        self.configDict['config_address'] = '0.0.0.0'
        self.configDict['config_port'] = 8081
        self.configDict['config_multiple_instance'] = True
        self.configDict['config_enable_file_cache'] = True
        self.configDict['config_start_browser'] = True
        self.configDict['config_resourcepath'] = "./res/"

        self.add_field_with_label('config_project_name', 'Project Name',
                                  gui.TextInput())
        self.add_field_with_label('config_address', 'IP address',
                                  gui.TextInput())
        self.add_field_with_label('config_port', 'Listen port',
                                  gui.SpinBox(8082, 1025, 65535))
        self.add_field_with_label(
            'config_multiple_instance',
            'Use single App instance for multiple users', gui.CheckBox(True))
        self.add_field_with_label('config_enable_file_cache',
                                  'Enable file caching', gui.CheckBox(True))
        self.add_field_with_label('config_start_browser',
                                  'Start browser automatically',
                                  gui.CheckBox(True))
        self.add_field_with_label('config_resourcepath',
                                  'Additional resource path', gui.TextInput())
        self.from_dict_to_fields(self.configDict)
Exemple #2
0
    def __init__(self, title='', message=''):
        super(ProjectConfigurationDialog, self).__init__(
            'Project Configuration',
            'Here are the configuration options of the project.',
            width=500)
        #standard configuration
        self.configDict = {}

        self.configDict[self.KEY_PRJ_NAME] = 'untitled'
        self.configDict[self.KEY_ADDRESS] = '0.0.0.0'
        self.configDict[self.KEY_PORT] = 8081
        self.configDict[self.KEY_MULTIPLE_INSTANCE] = True
        self.configDict[self.KEY_ENABLE_CACHE] = True
        self.configDict[self.KEY_START_BROWSER] = True
        self.configDict[self.KEY_RESOURCEPATH] = "./res/"

        self.add_field_with_label(self.KEY_PRJ_NAME, 'Project Name',
                                  gui.TextInput())
        self.add_field_with_label(self.KEY_ADDRESS, 'IP address',
                                  gui.TextInput())
        self.add_field_with_label(self.KEY_PORT, 'Listen port',
                                  gui.SpinBox(8082, 1025, 65535))
        self.add_field_with_label(
            self.KEY_MULTIPLE_INSTANCE,
            'Use single App instance for multiple users', gui.CheckBox(True))
        self.add_field_with_label(self.KEY_ENABLE_CACHE, 'Enable file caching',
                                  gui.CheckBox(True))
        self.add_field_with_label(self.KEY_START_BROWSER,
                                  'Start browser automatically',
                                  gui.CheckBox(True))
        self.add_field_with_label(self.KEY_RESOURCEPATH,
                                  'Additional resource path', gui.TextInput())
        self.from_dict_to_fields(self.configDict)
    def prompt_new_widget(self, widget):
        self.varname_list = list()

        self.build_widget_name_list_from_tree(self.appInstance.project)

        self.constructor_parameters_list = self.widgetClass.__init__.__code__.co_varnames[1:] #[1:] removes the self
        param_annotation_dict = ''#self.widgetClass.__init__.__annotations__
        self.dialog = gui.GenericDialog(title=self.widgetClass.__name__, message='Fill the following parameters list', width='40%')
        varNameTextInput = gui.TextInput()
        varNameTextInput.attributes['tabindex'] = '1'
        varNameTextInput.attributes['autofocus'] = 'autofocus'
        self.dialog.add_field_with_label('name', 'Variable name', varNameTextInput)
        #for param in self.constructor_parameters_list:
        for index in range(0,len(self.widgetClass.__init__._constructor_types)):
            param = self.constructor_parameters_list[index]
            _typ = self.widgetClass.__init__._constructor_types[index]
            note = ' (%s)'%_typ.__name__
            editWidget = None
            if _typ==int:
                editWidget = gui.SpinBox('0',-65536,65535)
            elif _typ==bool:
                editWidget = gui.CheckBox()
            else:
                editWidget = gui.TextInput()
            editWidget.attributes['tabindex'] = str(index+2)
            self.dialog.add_field_with_label(param, param + note, editWidget)

        self.dialog.add_field_with_label("editor_newclass", "Overload base class", gui.CheckBox())
        self.dialog.confirm_dialog.do(self.on_dialog_confirm)
        self.dialog.show(self.appInstance)
    def __init__(self, *args):
        super(HistoryEventWidget, self).__init__(*args)
        self.css_margin = "5px auto"
        self.add_class("border border-secondary")
        self.image_path: Optional[str] = None
        self.image_thumbnail = StaticPILImageWidget(None)
        self.labels_lbl = gui.Label("")
        self.event_date_lbl = gui.Label("")
        self.camera_name_lbl = gui.Label("")
        self.roi_name_lbl = gui.Label("")
        self.download_image_btn = SButton(
            "", "fa-file-download", styles={"padding": "5px 10px"}
        )
        self.select_checkbox = gui.CheckBox()

        self.image_thumbnail.set_size(*Config.MINI_THUMBNAIL_SIZE)
        self.image_thumbnail.css_margin = "1px"
        self.labels_lbl.css_width = "20%"
        self.event_date_lbl.css_width = "20%"

        hl = gui.HBox()
        hl.append(self.select_checkbox)
        hl.append(self.image_thumbnail)
        hl.append(self.labels_lbl)
        hl.append(self.event_date_lbl)
        hl.append(self.camera_name_lbl)
        hl.append(self.roi_name_lbl)
        hl.append(self.download_image_btn)
        self.layout = hl
        self.append(hl)

        # signals
        self.download_image_btn.onclick.do(self.on_download_image)
        self.image_thumbnail.onclick.do(self.on_download_image)
        self.select_checkbox.onclick.do(self.checkbox_toggled)
Exemple #5
0
    def menu_dialog_clicked(self, widget):
        self.dialog = gui.GenericDialog(title='Dialog Box', message='Click Ok to transfer content to main page', width='500px')
        self.dtextinput = gui.TextInput(width=200, height=30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input', self.dtextinput)

        self.dcheck = gui.CheckBox(False, width=200, height=30)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox', self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon', 'Roberto Robitaille')
        self.dlistView = gui.ListView.new_from_list(values, width=200, height=120)
        self.dialog.add_field_with_label('dlistView', 'Listview', self.dlistView)

        self.ddropdown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'),
                                                    width=200, height=20)
        self.dialog.add_field_with_label('ddropdown', 'Dropdown', self.ddropdown)

        self.dspinbox = gui.SpinBox(min=0, max=5000, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(10, 0, 100, 5, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(width=200, height=20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker', self.dcolor)

        self.ddate = gui.Date(width=200, height=20)
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.confirm_dialog.do(self.dialog_confirm)
        self.dialog.show(self)
Exemple #6
0
 def __init__(self, filename, *args, **kwargs):
     super(MiniatureImageWidget, self).__init__(*args, **kwargs)
     self.filename = filename
     self.style['margin'] = "2px"
     self.style['outline'] = "1px solid gray"
     self.check = gui.CheckBox(False)
     
     self.image = OpencvImageWidget(self.filename, height="100%")
     self.append([self.check, self.image])
Exemple #7
0
    def __init__(self, title='', message=''):
        super(ProjectConfigurationDialog, self).__init__('Configuration',
                                                         'Here are the configuration options of the project.', width=500)
#        # standard configuration
#        self.configDict = {}
#
#        self.configDict[self.KEY_PRJ_NAME] = 'untitled'
#        self.configDict[self.KEY_ADDRESS] = '0.0.0.0'
#        self.configDict[self.KEY_PORT] = 8081
#        self.configDict[self.KEY_MULTIPLE_INSTANCE] = True
#        self.configDict[self.KEY_ENABLE_CACHE] = True
#        self.configDict[self.KEY_START_BROWSER] = True
#        self.configDict[self.KEY_RESOURCEPATH] = "./res/"
#
#        self.add_field_with_label(
#            '', 'Project Name', gui.TextInput())
        self.add_field_with_label(
            'external_ip', 'IP address', gui.TextInput())
        self.add_field_with_label(
            'websocket_port', 'Listen port', gui.SpinBox(8082, 1025, 65535))
        self.add_field_with_label(
            'plot_w', 'Window w', gui.SpinBox(600, 100, 65535))
        self.add_field_with_label(
            'plot_h', 'Window h', gui.SpinBox(600, 100, 65535))
        self.add_field_with_label(
            'image_w', 'Image w', gui.SpinBox(20, 1, 100))
        self.add_field_with_label(
            'image_h', 'Image h', gui.SpinBox(20, 1, 100))
        self.add_field_with_label(
            'plot_label_size', 'Plot Label Size', gui.SpinBox(10, 1, 100))
        self.add_field_with_label(
            'axis_label', 'Axis Label', gui.CheckBox(True))
        self.add_field_with_label(
            'su_bin', 'SU Path', gui.TextInput())
        self.add_field_with_label(
            self.KEY_MULTIPLE_INSTANCE, 'Use single App instance for multiple users', gui.CheckBox(True))
        self.add_field_with_label(
            self.KEY_ENABLE_CACHE, 'Enable file caching', gui.CheckBox(True))
        self.add_field_with_label(
            self.KEY_START_BROWSER, 'Start browser automatically', gui.CheckBox(True))
#        self.add_field_with_label(
#            self.KEY_RESOURCEPATH, 'Additional resource path', gui.TextInput())
        self.from_dict_to_fields()
Exemple #8
0
    def __createEditor(self):
        attributeType = self._param._type
        additionalInfo = self._param._additionalInfo
        attributeValue = self._param._v
        attributeName = self._param._k
        attributeDesc = self._param._description
        if additionalInfo == None:
            additionalInfo = {}

        dprint('name', attributeName, 'type', attributeType, 'value',
               attributeValue, 'info', additionalInfo)

        self.inputWidget = None

        #'background-repeat':{'type':str, 'description':'The repeat behaviour of an optional background image', ,'additional_data':{'affected_widget_attribute':'style', 'possible_values':'repeat | repeat-x | repeat-y | no-repeat | inherit'}},
        if attributeType == bool or attributeType == 'bool':
            if attributeValue == 'true':
                attributeValue = True
            if attributeValue == 'false':
                attributeValue = False
            self.inputWidget = gui.CheckBox('checked')
        elif attributeType == int or attributeType == float or attributeType == 'int' or attributeType == 'float':
            min_val = -1000000
            if "min" in additionalInfo:
                min_val = additionalInfo['min']
            max_val = 1000000
            if "max" in additionalInfo:
                max_val = additionalInfo['max']
            step_val = 1
            if "step" in additionalInfo:
                step_val = additionalInfo['step']
            self.inputWidget = gui.SpinBox(attributeValue, min_val, max_val,
                                           step_val)
        elif attributeType == gui.ColorPicker:
            self.inputWidget = gui.ColorPicker()
        elif attributeType == 'dropdown':
            self.inputWidget = gui.DropDown()
            for value in additionalInfo['possible_values']:
                self.inputWidget.append(gui.DropDownItem(value), value)
#        elif attributeType == 'url_editor':
#            self.inputWidget = UrlPathInput(self._appInstance)
#        elif attributeType == 'css_size':
#            self.inputWidget = CssSizeInput(self._appInstance)
        else:  # default editor is string
            self.inputWidget = StringEditor()

        self.inputWidget.set_on_change_listener(self.on_attribute_changed)
        self.inputWidget.set_size('50%', '22px')
        self.inputWidget.attributes['title'] = attributeDesc
        self.inputWidget.style['float'] = 'right'
        self.inputWidget.set_value(attributeValue)
        dprint('setValue', attributeValue)
        dprint('getValue', self.inputWidget.get_value())

        self.append(self.inputWidget)
Exemple #9
0
    def menu_dialog_clicked(self):
        self.dialog = gui.GenericDialog(
            title='Dialog Box',
            message='Click Ok to transfer content to main page')

        self.dtextinput = gui.TextInput(200, 30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input',
                                         self.dtextinput)

        self.dcheck = gui.CheckBox(200, 30, False)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox',
                                         self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon',
                  'Roberto Robitaille')
        self.dlistView = gui.ListView(200, 120)
        key = 0
        for value in values:
            obj = gui.ListItem(170, 20, value)
            self.dlistView.append(str(key), obj)
            key += 1
        self.dialog.add_field_with_label('dlistView', 'Listview',
                                         self.dlistView)

        self.ddropdown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.ddropdown.append('0', c0)
        self.ddropdown.append('1', c1)
        self.ddropdown.set_value('Value1')
        self.dialog.add_field_with_label('ddropdown', 'Dropdown',
                                         self.ddropdown)

        self.dspinbox = gui.SpinBox(200, 20, min=0, max=5000)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(200, 20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker',
                                         self.dcolor)

        self.ddate = gui.Date(
            200,
            20,
        )
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.set_on_confirm_dialog_listener(self, 'dialog_confirm')
        self.dialog.show(self)
    def __init__(self, attributeName, attributeDict, appInstance=None):
        super(EditorAttributeInput, self).__init__()
        gui.EventSource.__init__(self)
        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style.update({'display':'block',
            'overflow':'auto',
            'margin':'2px',
            'outline':'1px solid lightgray'})
        self.attributeName = attributeName
        self.attributeDict = attributeDict
        self.EVENT_ATTRIB_ONCHANGE = 'on_attribute_changed'

        self.EVENT_ATTRIB_ONREMOVE = 'onremove_attribute'
        self.removeAttribute = gui.Image('/editor_resources:delete.png', width='5%')
        self.removeAttribute.attributes['title'] = 'Remove attribute from this widget.'
        self.removeAttribute.onclick.do(self.on_attribute_remove)
        self.append(self.removeAttribute)

        self.label = gui.Label(attributeName, width='45%', height=22, margin='0px')
        self.label.style['overflow'] = 'hidden'
        self.label.style['font-size'] = '13px'
        self.label.style['outline'] = '1px solid lightgray'
        self.append(self.label)
        self.inputWidget = None

        #'background-repeat':{'type':str, 'description':'The repeat behaviour of an optional background image', ,'additional_data':{'affected_widget_attribute':'style', 'possible_values':'repeat | repeat-x | repeat-y | no-repeat | inherit'}},
        if attributeDict['type'] in (bool,int,float,gui.ColorPicker,gui.DropDown,'url_editor','css_size'):
            if attributeDict['type'] == bool:
                self.inputWidget = gui.CheckBox('checked')
            if attributeDict['type'] == int or attributeDict['type'] == float:
                self.inputWidget = gui.SpinBox(attributeDict['additional_data']['default'], attributeDict['additional_data']['min'], attributeDict['additional_data']['max'], attributeDict['additional_data']['step'])
            if attributeDict['type'] == gui.ColorPicker:
                self.inputWidget = gui.ColorPicker()
            if attributeDict['type'] == gui.DropDown:
                self.inputWidget = gui.DropDown()
                for value in attributeDict['additional_data']['possible_values']:
                    self.inputWidget.append(gui.DropDownItem(value),value)
            if attributeDict['type'] == 'url_editor':
                self.inputWidget = UrlPathInput(appInstance)
            if attributeDict['type'] == 'css_size':
                self.inputWidget = CssSizeInput(appInstance)

        else: #default editor is string
            self.inputWidget = gui.TextInput()

        self.inputWidget.onchange.do(self.on_attribute_changed)
        self.inputWidget.set_size('50%','22px')
        self.inputWidget.attributes['title'] = attributeDict['description']
        self.label.attributes['title'] = attributeDict['description']
        self.append(self.inputWidget)
        self.inputWidget.style['float'] = 'right'

        self.style['display'] = 'block'
        self.set_valid(False)
Exemple #11
0
    def __init__(self, attributeName, attributeDict, appInstance=None):
        super(EditorAttributeInput, self).__init__()
        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style['display'] = 'block'
        self.style['overflow'] = 'auto'
        self.style['margin'] = '2px'
        self.attributeName = attributeName
        self.attributeDict = attributeDict
        self.EVENT_ATTRIB_ONCHANGE = 'on_attribute_changed'

        label = gui.Label(attributeName, width='50%', height=22)
        label.style['margin'] = '0px'
        label.style['overflow'] = 'hidden'
        label.style['font-size'] = '13px'
        self.append(label)
        self.inputWidget = None

        #'background-repeat':{'type':str, 'description':'The repeat behaviour of an optional background image', ,'additional_data':{'affected_widget_attribute':'style', 'possible_values':'repeat | repeat-x | repeat-y | no-repeat | inherit'}},
        if attributeDict['type'] in (bool, int, float, gui.ColorPicker,
                                     gui.DropDown, gui.FileSelectionDialog):
            if attributeDict['type'] == bool:
                self.inputWidget = gui.CheckBox('checked')
            if attributeDict['type'] == int or attributeDict['type'] == float:
                self.inputWidget = gui.SpinBox(
                    attributeDict['additional_data']['default'],
                    attributeDict['additional_data']['min'],
                    attributeDict['additional_data']['max'],
                    attributeDict['additional_data']['step'])
            if attributeDict['type'] == gui.ColorPicker:
                self.inputWidget = gui.ColorPicker()
            if attributeDict['type'] == gui.DropDown:
                self.inputWidget = gui.DropDown()
                for value in attributeDict['additional_data'][
                        'possible_values']:
                    self.inputWidget.append(gui.DropDownItem(value), value)
            if attributeDict['type'] == gui.FileSelectionDialog:
                self.inputWidget = UrlPathInput(appInstance)

        else:  #default editor is string
            self.inputWidget = gui.TextInput()

        self.inputWidget.set_size('50%', '22px')
        self.inputWidget.attributes['title'] = attributeDict['description']
        label.attributes['title'] = attributeDict['description']
        self.inputWidget.set_on_change_listener(self, "on_attribute_changed")
        self.append(self.inputWidget)
        self.inputWidget.style['float'] = 'right'

        self.style['display'] = 'block'
Exemple #12
0
    def menu_dialog_clicked(self):
        self.dialog = gui.GenericDialog(
            title='Dialog Box',
            message='Click Ok to transfer content to main page')
        self.dialog.style['width'] = '300px'
        self.dtextinput = gui.TextInput(width=200, height=30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input',
                                         self.dtextinput)

        self.dcheck = gui.CheckBox(False, width=200, height=30)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox',
                                         self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon',
                  'Roberto Robitaille')
        self.dlistView = gui.ListView(width=200, height=120)
        for key, value in enumerate(values):
            self.dlistView.append(value, key=str(key))
        self.dialog.add_field_with_label('dlistView', 'Listview',
                                         self.dlistView)

        self.ddropdown = gui.DropDown(width=200, height=20)
        c0 = gui.DropDownItem('DropDownItem 0', width=200, height=20)
        c1 = gui.DropDownItem('DropDownItem 1', width=200, height=20)
        self.ddropdown.append(c0)
        self.ddropdown.append(c1)
        self.ddropdown.set_value('Value1')
        self.dialog.add_field_with_label('ddropdown', 'Dropdown',
                                         self.ddropdown)

        self.dspinbox = gui.SpinBox(min=0, max=5000, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(10, 0, 100, 5, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(width=200, height=20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker',
                                         self.dcolor)

        self.ddate = gui.Date(width=200, height=20)
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.set_on_confirm_dialog_listener(self, 'dialog_confirm')
        self.dialog.show(self)
Exemple #13
0
    async def build_title(self):
        row = G.TableRow(width="100%")

        checkbox_all = G.CheckBox(checked=False)
        row.append(TableExtendedItem(checkbox_all, width="20px"), str(0))

        for index, field_name in enumerate(self.fields):
            style_args = dict()
            width = getattr(self, f"WIDTH_{field_name}", None)
            if width:
                style_args['width'] = width

            row.append(TableExtendedItem(G.Label(field_name), **style_args),
                       str(index + 1))

        self.append(row, "title_{0}")
Exemple #14
0
    def create_bool_row(self, param_name, description, current_value,
                        callback_cb):
        row = gui.TableRow()
        param_name = gui.Label(param_name,
                               width=NAME_L_SIZE,
                               height=FIELD_HEIGHT)
        param_name.attributes['title'] = description
        checkbox = gui.CheckBox(width=SLIDER_SIZE,
                                height=FIELD_HEIGHT,
                                checked=current_value)
        checkbox.set_on_change_listener(callback_cb)

        item = gui.TableItem()
        item.add_child(0, param_name)
        row.add_child(0, item)

        # Dummy item
        item = gui.TableItem()
        item.add_child(1, "")
        row.add_child(1, item)

        item = gui.TableItem()
        item.add_child(2, checkbox)
        row.add_child(2, item)
        # To center the checkbox
        checkbox.style['float'] = 'none'
        checkbox.style['margin'] = '0px auto'
        checkbox.style['display'] = 'block'

        # Dummy item
        item = gui.TableItem()
        item.add_child(3, "")
        row.add_child(3, item)

        # Dummy item
        item = gui.TableItem()
        item.add_child(4, "")
        row.add_child(4, item)

        return row, [checkbox.set_value]
Exemple #15
0
    def build_keg_settings(self,
                           index=None,
                           channel=None,
                           chan_conf=None,
                           readonly=False,
                           edit=False):
        utils.debug_msg(self, "start")

        keg_box_style = {
            'border': '2px solid lightgrey',
            'border-radius': '5px'
        }
        keg_box = gui.Container(style=keg_box_style)
        utils.debug_msg(self, "keg_box")

        box_name = gui.Label('Channel')
        keg_box.append(box_name)
        utils.debug_msg(self, "box_name")

        keg_name = gui.HBox()
        keg_name_lbl = gui.Label('Keg Name', width='20%')
        keg_name.append(keg_name_lbl, 'lbl')
        keg_name_val = gui.TextInput(single_line=True, height='1.5em')
        keg_name.append(keg_name_val, 'val')
        keg_box.append(keg_name, 'name')
        utils.debug_msg(self, "keg_name")

        keg_size_list = list(utils.keg_data)
        keg_size_list.append('custom')
        keg_size_list.insert(0, '')
        utils.debug_msg(self, "keg_size_list")

        keg_size = gui.HBox()
        keg_size_lbl = gui.Label('Keg Size', width='20%')
        keg_size.append(keg_size_lbl, 'lbl')
        keg_size_val = gui.DropDown.new_from_list(keg_size_list)
        keg_size_val.set_value('')
        keg_size.append(keg_size_val, 'val')
        keg_box.append(keg_size, 'size')
        utils.debug_msg(self, "keg_size")

        custom = gui.HBox()
        vol_lbl = gui.Label('Volume (l)', width='20%')
        custom.append(vol_lbl, 0)
        custom_vol = gui.TextInput(single_line=True,
                                   height='1.5em',
                                   width='30%')
        custom.append(custom_vol, 1)
        tare_lbl = gui.Label('Empty Weight (kg)', width='30%')
        custom.append(tare_lbl, 2)
        custom_tare = gui.TextInput(single_line=True,
                                    height='1.5em',
                                    width='20%')
        custom.append(custom_tare, 3)
        keg_box.append(custom, 'custom')
        utils.debug_msg(self, "custom_size")

        co2_box = gui.HBox(width='20%')
        co2_label = gui.Label('CO2')
        co2_box.append(co2_label, 0)
        co2_check = gui.CheckBox('CO2', False)
        co2_box.append(co2_check, 1)
        keg_box.append(co2_box, 'co2_box')
        utils.debug_msg(self, "co2_box")

        if chan_conf != None and index != None and channel != None:
            utils.debug_msg(self, "populating keg info")
            cap = chan_conf['volume']
            tare = chan_conf['tare']
            name = chan_conf['name']
            size_name = chan_conf['size']
            co2 = chan_conf['co2']

            box_name.set_text('Sensor ' + str(index) + ' Channel ' + channel)
            keg_name_val.set_value(name)
            keg_size_val.select_by_value(size_name)
            custom_vol.set_value(str(cap))
            custom_tare.set_value(str(tare))
            co2_check.set_value(co2)
            utils.debug_msg(self, "end populating keg info")

        if edit != False:
            utils.debug_msg(self, "edit and delete buttons")
            edit_keg_button = gui.Button('Edit',
                                         width=100,
                                         height=30,
                                         style={'margin': '3px'})
            edit_keg_button.onclick.do(self.show_edit_keg, index, channel)
            keg_box.append(edit_keg_button, 'edit_keg')
            utils.debug_msg(self, "edit button")

            del_keg_button = gui.Button('Delete',
                                        width=100,
                                        height=30,
                                        style={'margin': '3px'})
            del_keg_button.onclick.do(self.show_delete_keg_confirm, index,
                                      channel)
            keg_box.append(del_keg_button, 'del_keg')
            utils.debug_msg(self, "delete button")

        if readonly == True:
            utils.debug_msg(self, "settings are readonly")
            keg_name_val.set_enabled(False)
            keg_size_val.set_enabled(False)
            custom_vol.set_enabled(False)
            custom_tare.set_enabled(False)
            co2_check.set_enabled(False)

        utils.debug_msg(self, "end")
        return keg_box
Exemple #16
0
 def test_init(self):
     widget = gui.CheckBox()
     assertValidHTML(widget.repr())
Exemple #17
0
 def add_checkbox(self, key: str, desc: str, **kwargs):
     label = gui.CheckBox(checked=True, **kwargs)
     self.add_field(key=key, desc=desc, field=label)