Ejemplo n.º 1
0
 def on_go_btn_pressed(self, widget):
     doing_dialog = gui.GenericDialog("", "Doing", width=500, height=100)
     doing_dialog.show(self)
     m3u_path = self.gen_m3u()
     doing_dialog.hide()
     done_dialog = gui.GenericDialog("",
                                     "m3u created at [{}]".format(m3u_path),
                                     width=500,
                                     height=100)
     done_dialog.show(self)
Ejemplo n.º 2
0
    def on_dialog_confirm(self, widget):
        """ Here the widget is allocated
        """
        variableName = str(self.dialog.get_field("name").get_value())
        if re.match('(^[a-zA-Z][a-zA-Z0-9_]*)|(^[_][a-zA-Z0-9_]+)', variableName) == None:
            self.errorDialog = gui.GenericDialog("Error", "Please type a valid variable name.", width=350,height=120)
            self.errorDialog.show(self.appInstance)
            return

        if variableName in self.varname_list:
            self.errorDialog = gui.GenericDialog("Error", "The typed variable name is already used. Please specify a new name.", width=350,height=150)
            self.errorDialog.show(self.appInstance)
            return

        param_annotation_dict = ''#self.widgetClass.__init__.__annotations__
        param_values = []
        param_for_constructor = []
        for index in range(0,len(self.widgetClass.__init__._constructor_types)):
            param = self.constructor_parameters_list[index]
            _typ = self.widgetClass.__init__._constructor_types[index]
            if _typ==int:
                param_for_constructor.append(self.dialog.get_field(param).get_value())
                param_values.append(int(self.dialog.get_field(param).get_value()))
            elif _typ==bool:
                param_for_constructor.append(self.dialog.get_field(param).get_value())
                param_values.append(bool(self.dialog.get_field(param).get_value()))
            else:#if _typ==str:
                param_for_constructor.append("""\'%s\'"""%self.dialog.get_field(param).get_value())
                param_values.append(self.dialog.get_field(param).get_value())
            #else:
            #    param_for_constructor.append("""%s"""%self.dialog.get_field(param).get_value())

        print(self.constructor_parameters_list)
        print(param_values)
        #constructor = '%s(%s)'%(self.widgetClass.__name__, ','.join(map(lambda v: str(v), param_values)))
        constructor = '(%s)'%(','.join(map(lambda v: str(v), param_for_constructor)))
        #here we create and decorate the widget
        widget = self.widgetClass(*param_values, **self.kwargs_to_widget)
        widget.attributes.update({'editor_constructor':constructor,
            'editor_varname':variableName,
            'editor_tag_type':'widget',
            'editor_newclass':'True' if self.dialog.get_field("editor_newclass").get_value() else 'False',
            'editor_baseclass':widget.__class__.__name__}) #__class__.__bases__[0].__name__
        #"this.style.cursor='default';this.style['left']=(event.screenX) + 'px'; this.style['top']=(event.screenY) + 'px'; event.preventDefault();return true;"
        #if not 'position' in widget.style:
        #    widget.style['position'] = 'absolute'
        #if not 'display' in widget.style:
        #    widget.style['display'] = 'block'

        for key in self.optional_style_dict:
            widget.style[key] = self.optional_style_dict[key]
        self.optional_style_dict = {}

        self.appInstance.add_widget_to_editor(widget)
Ejemplo n.º 3
0
 def test_init(self):
     widget = gui.GenericDialog(title='testing title',
                                message='testing message')
     
     self.assertIn('testing title', widget.repr())
     self.assertIn('testing message', widget.repr())
     assertValidHTML(widget.repr())
Ejemplo n.º 4
0
    def text_message(self, message):
        self.custom_dialog = gui.GenericDialog(title='Dialog Box', width='600px')
        text_input = gui.TextInput(single_line=False)
        text_input.set_text(message)

        self.custom_dialog.add_field_with_label('text_input_messade', 'System Message', text_input)
        self.custom_dialog.show(self)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    def cbk_add_user(self, widget):
        self.dialog = gui.GenericDialog(title="New user",
                                        message="Click Ok to save the user",
                                        width="500px")

        self.dname = gui.TextInput(width=200, height=30)
        self.dialog.add_field_with_label("dname", "Name", self.dname)

        self.dage = gui.TextInput(width=200, height=30)
        self.dialog.add_field_with_label("dage", "Age", self.dage)

        self.dgender = gui.DropDown.new_from_list(["Female", "Male", "Other"],
                                                  width=200,
                                                  height=30)
        self.dgender.select_by_value("Male")
        self.dialog.add_field_with_label("dgender", "Gender", self.dgender)

        self.dteleop = gui.TextInput(width=200, height=30)
        self.dteleop.set_value("0")
        self.dialog.add_field_with_label(
            "dteleop", "Total hours flying teleoperated UAVs", self.dteleop)

        self.dflying = gui.TextInput(width=200, height=30)
        self.dflying.set_value("0")
        self.dialog.add_field_with_label("dflying",
                                         "Total hours flying other vehicles",
                                         self.dflying)

        self.dialog.set_on_confirm_dialog_listener(
            self.add_user_dialog_confirm)
        self.dialog.show(self)
Ejemplo n.º 7
0
 def filtersMenu(self, widget):
     self.dialog = gui.GenericDialog(
         title='Filters Menu',
         message='Click Ok To Confirm Selection',
         width='300px')
     self.main_cont = gui.HBox(width=300)
     dates_cont = gui.VBox(width='50%')
     for date in dates:
         chb = gui.CheckBoxLabel(date, filt[date])
         chb.onchange.do(self.checkbox)
         dates_cont.append(chb)
     chb.onchange.do(self.checkbox)
     dates_cont.append(chb)
     self.main_cont.append(dates_cont)
     names_cont = gui.VBox(width='50%')
     for name in names:
         chb = gui.CheckBoxLabel(name, filt[name])
         chb.onchange.do(self.checkbox)
         names_cont.append(chb)
     self.main_cont.append(names_cont)
     names_cont.style['align-items'] = 'flex-start'
     dates_cont.style['align-items'] = 'flex-start'
     names_cont.style['justify-content'] = 'flex-start'
     dates_cont.style['justify-content'] = 'flex-start'
     self.dialog.add_field('main_cont', self.main_cont)
     self.dialog.confirm_dialog.do(self.diag_conf)
     self.dialog.show(self)
Ejemplo n.º 8
0
    def do_tlx(self, widget, user, type_):
        self.dialog = gui.GenericDialog(
            title="NASA-TLX",
            message=
            f"NASA Task Load Index for the {type_.name} view experiment performed by {user.name}. How much did each component contribute to your task load? (scale from 0 to 20)",
            width="600px")

        for component in self.tlx.components.values():
            self.dialog.add_field(
                component.code,
                gui.Label(f"{component.name}: {component.description}",
                          margin="10px"))
            slider = gui.Slider(component.score, 0, 20, 1, width="80%")
            slider.set_oninput_listener(self.tlx_slider_changed,
                                        component.code)
            slider_value = gui.Label(slider.get_value(), margin="10px")
            self.tlx_sliders[component.code] = (slider, slider_value)
            box = gui.Widget(width="100%",
                             layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
                             height=50)
            box.append(slider_value)
            box.append(slider)
            self.dialog.add_field(component.code + "_score", box)

        self.dialog.set_on_confirm_dialog_listener(self.tlx_done, user, type_)
        self.dialog.show(self)
Ejemplo n.º 9
0
    def _tlx_weighting(self, user, type_):
        self.all_combos = list(list(pair) for pair in combinations(self.tlx.components.keys(), 2))
        shuffle(self.all_combos)
        self.weights = {k: 0 for k in self.tlx.components.keys()}

        self.weight_index = 0
        self.pair = ["", ""]

        self.dialog = gui.GenericDialog(title="NASA-TLX Weighting", message=f"NASA Task Load Index for the {type_.name} view experiment performed by {user.name}. Which component do you feel contributed more to your task load?", width="300px")

        self.weight_progress_label = gui.Label(f"1/{len(self.all_combos)}")
        self.dialog.add_field("dweightprogress", self.weight_progress_label)

        box = gui.HBox(width="100%", height=50, margin="10px")
        self.button_left = gui.Button("", margin="10px")
        self.button_right = gui.Button("", margin="10px")
        box.append(self.button_left)
        box.append(self.button_right)
        self.dialog.add_field("dweightbox", box)

        self.pair = self.all_combos[self.weight_index]
        shuffle(self.pair)
        self.button_left.set_text(self.tlx.components[self.pair[0]].name)
        self.button_right.set_text(self.tlx.components[self.pair[1]].name)
        self.button_left.set_on_click_listener(self.weight_button_pressed, self.pair[0])
        self.button_right.set_on_click_listener(self.weight_button_pressed, self.pair[1])

        self.dialog.set_on_confirm_dialog_listener(self.weighting_done)
        self.dialog.show(self)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
 def get_contact(self, widget):
     self.dialog = gui.GenericDialog(title="Get Contact", width="500px")
     name = self.textinput.get_value()
     result = self.assistant.get_contact(name)
     self.label = gui.Label(name + " is " + result, width=200, height=30)
     self.dialog.add_field("label", self.label)
     self.dialog.cancel_dialog.connect(self.reset_dropdown)
     self.dialog.show(self)
     self.reset_dropdown(widget)
Ejemplo n.º 12
0
    def show_settings(self, widget):
        utils.debug_msg(self, "start")
        if self.settings_up == True:
            utils.debug_msg(self, "show_settings already up")
            return
        else:
            self.settings_up = True

        self.api_read(force=True)

        self.settings_dialog = gui.GenericDialog(title='Settings',
                                                 width='500px')
        utils.debug_msg(self, "settings_dialog")

        # weight display options
        weight_options_list = ['as_kg_gross', 'as_kg_net', 'as_pint', 'as_pct']
        weight_options = gui.DropDown.new_from_list(weight_options_list)
        try:
            weight_options.select_by_value(self.api_data['weight_mode'])
        except (KeyError, IndexError):
            pass
        self.settings_dialog.add_field_with_label('weight_options',
                                                  'Display Keg Weight',
                                                  weight_options)
        utils.debug_msg(self, "weight_options")

        for index, hx_conf in enumerate(self.api_data['hx_list']):
            for channel in ('A', 'B'):
                try:
                    chan_conf = hx_conf['channels'][channel]
                    keg_box = self.build_keg_settings(index,
                                                      channel,
                                                      chan_conf,
                                                      readonly=True,
                                                      edit=True)
                    self.settings_dialog.add_field(
                        str(index) + channel + '_box', keg_box)
                    utils.debug_msg(self,
                                    "index %s channel %s" % (index, channel))
                except (KeyError, IndexError):
                    pass

        add_keg_button = gui.Button('Add/Edit Keg',
                                    width=100,
                                    height=30,
                                    style={'margin': '3px'})
        add_keg_button.set_on_click_listener(self.show_edit_keg)
        self.settings_dialog.children['buttons_container'].add_child(
            'add_keg', add_keg_button)
        utils.debug_msg(self, "add_keg_button")

        self.settings_dialog.set_on_cancel_dialog_listener(
            self.cancel_settings)
        self.settings_dialog.set_on_confirm_dialog_listener(
            self.apply_settings)
        self.settings_dialog.show(self)
        utils.debug_msg(self, "end")
Ejemplo n.º 13
0
 def menu_became_a_patron(self, widget):
     dialog = gui.GenericDialog(
         "Became a Patron", "This editor is made for you with passion. \nIt would be fantastic if you give a contribution, also a little one. ;-)", width="50%")
     dialog.add_field("link", gui.Link("https://www.patreon.com/remigui",
                                       "Click this link to Donate", True, style={'font-weight': 'bolder'}))
     dialog.children["message"].style['white-space'] = 'pre'
     dialog.cancel.style['display'] = 'none'
     dialog.conf.set_text("Back")
     dialog.show(self)
Ejemplo n.º 14
0
 def print_job(self):
     try:
         send_egv(self.selected_file)
         self.status_lbl.set_text('Print Completed: ' + self.selected_file)
     except Exception as e:
         print(traceback.format_exc())
         inputDialog = gui.GenericDialog('Print Error', str(e))
         inputDialog.show(self)
         self.status_lbl.set_text('Print Error: ' + self.selected_file)
     self.clear_selected_file()
Ejemplo n.º 15
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)
Ejemplo n.º 16
0
 def on_profile_upload_clicked(self):
     self.profile_upload_dialog=gui.GenericDialog(width=500,height=200,title='<b>Upload Profile</b>',
                                                  message='Select Profile to Upload',autohide_ok=False)
     self.profile_upload_button=gui.FileUploader(self.upload_dir_path+os.sep,width=250,height=30,multiple_selection_allowed=False)
     self.profile_upload_button.set_on_success_listener(self,'on_profile_upload_success')
     self.profile_upload_button.set_on_failed_listener(self,'on_profile_upload_failed')
     self.profile_upload_status=gui.Label('', width=450, height=30)
     self.profile_upload_dialog.add_field('1',self.profile_upload_button)
     self.profile_upload_dialog.add_field('2',self.profile_upload_status)
     self.profile_upload_dialog.show(self)
     self.profile_upload_dialog.set_on_confirm_dialog_listener(self,'on_profile_upload_dialog_confirm')
Ejemplo n.º 17
0
 def new_halcon_code(self, data):
     if self.dialog == None:
         if data == 'nocode':
             self.imgGrabber.nextFrame()
         else:
             self.dialog = gui.GenericDialog(title='DECODE OK',
                                             message=data,
                                             width='200px')
             self.dialog.set_on_confirm_dialog_listener(
                 self.on_dialog_confirm)
             self.dialog.show(self)
Ejemplo n.º 18
0
    def on_bt_delUser_pressed(self, widget):
        #print("bt_delUser_pressed!")
        self.lbl_admin_panel_message.set_text('')
        self.delUser_dialog = gui.GenericDialog("Delete user",
                                                "Type here the user info",
                                                width=300)
        username_input = gui.Input(width=250)
        self.delUser_dialog.add_field_with_label('username', 'Username',
                                                 username_input)

        self.delUser_dialog.confirm_dialog.do(self.on_delUser_confirm)
        self.delUser_dialog.show(self)
Ejemplo n.º 19
0
    def nutrients_clicked(self, widget):
        nutrients_setpoints = self.read_from_pickle("nutrients_setpoints")
        ph_value = self.read_from_pickle("ph_sensor")

        self.nutrients_control = gui.GenericDialog(title='Nutrient Control',
                                                   width='100%',
                                                   height='100%')
        nutrients_container = gui.Widget(width='100%',
                                         height='100%',
                                         margin='0px auto',
                                         style={
                                             'text-align': 'center',
                                             'display': 'block',
                                             'overflow': 'auto'
                                         })
        self.ph_label = gui.Label('pH setpoint: ' +
                                  str(nutrients_setpoints['ph']),
                                  width='100%',
                                  height=30,
                                  margin='0px')
        self.ph_slider = gui.Slider(nutrients_setpoints['ph'],
                                    0,
                                    14,
                                    0.25,
                                    width='80%',
                                    height=30,
                                    margin='20px')
        self.ph_slider.onchange.do(self.ph_slider_changed)
        self.ph_sensor_label = gui.Label('current reservoir pH: ',
                                         width='100%',
                                         height=30,
                                         margin='0px')

        spacer = gui.Widget(width='100%',
                            height=75,
                            margin='0px auto',
                            style={
                                'display': 'block',
                                'overflow': 'auto'
                            })
        spacer_label = gui.Label('', width='100%', height=20, margin='0px')

        nutrients_container.append([
            spacer_label, self.ph_label, self.ph_slider, self.ph_sensor_label,
            spacer
        ])
        self.nutrients_control.add_field("nutrients", nutrients_container)
        self.nutrients_control.confirm_dialog.do(self.nutrients_confirm)

        self.ph_sensor_label.set_text("current reservoir pH: " +
                                      str(ph_value["ph"]))

        self.nutrients_control.show(self)
Ejemplo n.º 20
0
    def open_confirmation(self, widget):
        self.dialog = gui.GenericDialog(
            title='Confirmation Page',
            message='Are you sure you want to set laser to ' +
            str(self.wavelength) + ' nm wavelength and ' + str(self.pow) +
            ' db power?')
        self.dialog.set_size(350, 150)
        #self.set_root_widget(self.dialog)
        self.dialog.set_on_confirm_dialog_listener(self.confirm_dialog(widget))
        #self.dialog.set_on_cancel_dialog_listener(self.maidialogn())

        self.dialog.show(self)
Ejemplo n.º 21
0
    def on_prompt_login(self, emitter):
        self.login_dialog = gui.GenericDialog("Login",
                                              "Type here login data",
                                              width=300)
        username_input = gui.Input(width=250)
        password_input = gui.Input(input_type='password', width=250)
        password_input.attributes['type'] = 'password'
        self.login_dialog.add_field_with_label('username', 'Username',
                                               username_input)
        self.login_dialog.add_field_with_label('password', 'Password',
                                               password_input)

        self.login_dialog.confirm_dialog.do(self.on_login_confirm)
        self.login_dialog.show(self)
Ejemplo n.º 22
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)
Ejemplo n.º 23
0
 def on_profile_download_clicked(self):
     if self.current_profile != '':
         dest=self.upload_dir_path+os.sep+self.current_profile_name
         base=self.pp_home_dir+os.sep+'pp_profiles'+self.current_profile
         shutil.make_archive(dest,'zip',base)
         self.profile_download_dialog=gui.GenericDialog(width=500,height=200,title='<b>Download Profile</b>',
                                                        message='',autohide_ok=False)
         self.profile_download_button = gui.FileDownloader('Click Link to Download', dest+'.zip', width=200, height=30)
         self.profile_download_status=gui.Label('', width=450, height=30)
         self.profile_download_dialog.add_field('1',self.profile_download_button)
         self.profile_download_dialog.add_field('2',self.profile_download_status)
         self.profile_download_dialog.show(self)
         self.profile_download_dialog.set_on_confirm_dialog_listener(self,'on_profile_download_dialog_confirm')
     else:
         OKDialog('Download Profile', 'Error: No profile selected').show(self)
Ejemplo n.º 24
0
    def addClicked(self, widget):
        #        selected_item_key = self._moduleList.get_key ()
        #        module_item = self._moduleList.children[selected_item_key]

        addModuleDialog = gui.GenericDialog('Add new module', 'Choose module',
                                            width=500, height=160)
        
        # TODO new from list is not suitable
        drop = gui.DropDown()
        for i in range(len(g_moduleList)):
            drop.append(g_moduleNames[i], g_moduleList[i])
        addModuleDialog.add_field(
            "ModuleName", drop)
        addModuleDialog.set_on_confirm_dialog_listener(
            self.addClickedConfirmed)
        
        addModuleDialog.show(self._appInstance)
Ejemplo n.º 25
0
    def cbk_user_selected(self, widget, user):
        self.dialog = gui.GenericDialog(title="User page", message="Click Ok to return", width="500px")

        self.dialog.add_field_with_label("dname", "ID", gui.Label(f"{user.id_}"))
        self.dialog.add_field_with_label("dname", "Name", gui.Label(f"{user.name}"))
        self.dnex = gui.Label(len(user.experiments))
        self.dialog.add_field_with_label("dnex", "Number of experiments", self.dnex)

        run_random_experiment_button = gui.Button("Run random experiment")
        run_random_experiment_button.set_on_click_listener(self.run_random_experiment, user)

        self._user_tlx_tables = {}
        self.update_tabs(user)

        self.dialog.add_field("drandom", run_random_experiment_button)
        self.dialog.add_field("dtabs", self.tab_box)
        self.dialog.set_on_confirm_dialog_listener(self.done_user_confirm)
        self.dialog.show(self)
Ejemplo n.º 26
0
    def fan_clicked(self, widget):
        #read from pickle
        fan_setpoints = self.read_from_pickle("fan_setpoints")

        self.fan_control = gui.GenericDialog(title='Fan Control',
                                             width='100%',
                                             height='100%')
        fan_container = gui.Widget(width='100%',
                                   height='100%',
                                   margin='0px auto',
                                   style={
                                       'text-align': 'center',
                                       'display': 'block',
                                       'overflow': 'auto'
                                   })
        self.fan_label = gui.Label('Fan Speed: ' + str(fan_setpoints['fan']) +
                                   '%',
                                   width='95%',
                                   height=30,
                                   margin='10px')
        self.fan_slider = gui.Slider(fan_setpoints['fan'],
                                     0,
                                     100,
                                     1,
                                     width='80%',
                                     height=30,
                                     margin='20px')
        self.fan_slider.onchange.do(self.fan_slider_changed)

        spacer = gui.Widget(width='100%',
                            height=84,
                            margin='0px auto',
                            style={
                                'display': 'block',
                                'overflow': 'auto'
                            })
        spacer_label = gui.Label('', width='100%', height=20, margin='0px')

        fan_container.append(
            [spacer_label, self.fan_label, self.fan_slider, spacer])
        self.fan_control.add_field("fan", fan_container)
        self.fan_control.confirm_dialog.do(self.fan_confirm)
        self.fan_control.show(self)
Ejemplo n.º 27
0
 def check_if_win(self):
     """Here are counted the flags. Is checked if the user win."""
     self.flagcount = 0
     win = True
     for x in range(0, len(self.mine_matrix[0])):
         for y in range(0, len(self.mine_matrix)):
             if self.mine_matrix[y][x].state == 1:
                 self.flagcount += 1
                 if not self.mine_matrix[y][x].has_mine:
                     win = False
             elif self.mine_matrix[y][x].has_mine:
                 win = False
     self.lblMineCount.set_text("%s" % self.minecount)
     self.lblFlagCount.set_text("%s" % self.flagcount)
     if win:
         self.dialog = gui.GenericDialog(title='You Win!', message='Game done in %s seconds' % self.time_count)
         self.dialog.confirm_dialog.connect(self.new_game)
         self.dialog.cancel_dialog.connect(self.new_game)
         self.dialog.show(self)
Ejemplo n.º 28
0
    def show_delete_keg_confirm(self, widget, index, channel):
        utils.debug_msg(self, "start")
        if self.delete_keg_up == True:
            return
        else:
            self.delete_keg_up = True

        self.delete_keg_dialog = gui.GenericDialog(title='DELETE Keg?',
                                                   width=240)
        warning_label = gui.Label(
            "Are you sure you want to delete keg at index %s channel %s?" %
            (index, channel))
        self.delete_keg_dialog.append(warning_label)
        self.delete_keg_dialog.set_on_cancel_dialog_listener(
            self.cancel_delete_keg)
        self.delete_keg_dialog.children['buttons_container'].children[
            'confirm_button'].onclick.do(self.delete_keg, index, channel)
        self.delete_keg_dialog.show(self)
        utils.debug_msg(self, "end")
Ejemplo n.º 29
0
    def on_bt_EditUser_pressed(self, widget):
        #print("bt_EditUser_pressed!")
        self.lbl_admin_panel_message.set_text('')
        self.EditUser_dialog = gui.GenericDialog("Edit user credential",
                                                 "Type here the user info",
                                                 width=300)
        username_input = gui.Input(width=250)
        password_input = gui.Input(input_type='password', width=250)
        user_level_input = gui.DropDown.new_from_list(
            ('Admin', 'Operator', 'guest'), width=200, height=20, margin='8px')
        password_input.attributes['type'] = 'password'
        self.EditUser_dialog.add_field_with_label('username', 'Username',
                                                  username_input)
        self.EditUser_dialog.add_field_with_label('password', 'Password',
                                                  password_input)
        self.EditUser_dialog.add_field_with_label('userlevel', 'User level',
                                                  user_level_input)

        self.EditUser_dialog.confirm_dialog.do(self.on_EditUser_confirm)
        self.EditUser_dialog.show(self)
Ejemplo n.º 30
0
    def on_options_autostart_menu_clicked(self):
        self.options_autostart_dialog=gui.GenericDialog(width=450,height=300,title='Auotstart Options',
                                            message='Edit then click OK or Cancel',autohide_ok=False)
             


        self.autostart_path_field= gui.TextInput(width=250, height=30)
        self.autostart_path_field.set_text(self.autostart_path)
        self.options_autostart_dialog.add_field_with_label('autostart_path_field','Autostart Profile Path',self.autostart_path_field)

         
        self.autostart_options_field= gui.TextInput(width=250, height=30)
        self.autostart_options_field.set_text(self.autostart_options)
        self.options_autostart_dialog.add_field_with_label('autostart_options_field','Autostart Options',self.autostart_options_field)

        self.autostart_error=gui.Label('',width=440,height=30)
        self.options_autostart_dialog.add_field('autostart_error',self.autostart_error)

        self.options_autostart_dialog.set_on_confirm_dialog_listener(self,'on_options_autostart_dialog_confirm')
        self.options_autostart_dialog.show(self)