Example #1
0
    def _init_elements(self):
        self._date_end = date.today()
        self._date_start = self._date_end - timedelta(days=3)

        self._scanning_file_message = gui.HBox(
            style="align-self: flex-start; margin-bottom: 10px")
        self._scanning_file_message.append(
            gui.Image("/res:spinner.gif", style="margin-right: 4px"))
        self._scanning_file_message.append(gui.Label("Scanning files"))
        self.append(self._scanning_file_message)
        hide(self._scanning_file_message)

        file_form = gui.HBox(style="margin-bottom: 20px; flex-wrap: wrap")

        self._brewer_dd = gui.DropDown()
        self._update_brewer_ids()
        self._brewer_dd.onchange.do(self._on_bid_change)
        self._brewer_input = LabeledInput("Brewer id",
                                          self._brewer_dd,
                                          style="margin-right: 20px")

        self._uvr_dd = gui.DropDown()
        self._update_uvr_files()
        self._uvr_dd.onchange.do(self._on_uvr_change)
        self._uvr_input = LabeledInput("UVR file",
                                       self._uvr_dd,
                                       style="margin-right: 20px")

        self._date_start_selector = gui.Date(default_value="2019-06-24")
        self._date_start_selector.onchange.do(self._on_date_start_change)
        self._date_start_input = LabeledInput("Start date",
                                              self._date_start_selector,
                                              style="margin-right: 20px")

        self._date_end_selector = gui.Date(default_value="2019-06-27")
        self._date_end_selector.onchange.do(self._on_date_end_change)
        self._date_end_input = LabeledInput("End date",
                                            self._date_end_selector,
                                            style="margin-right: 20px")

        file_form.append(self._brewer_input)
        file_form.append(self._uvr_input)
        file_form.append(self._date_start_input)
        file_form.append(self._date_end_input)

        self.append(file_form)

        self._refresh_button = gui.Button("Refresh files",
                                          style="margin-bottom: 10px")
        self._refresh_button.onclick.do(self.refresh)

        self.append(self._refresh_button)
Example #2
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)
Example #3
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)
Example #4
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)
Example #5
0
    def main(self):
        verticalContainer = gui.Widget(width=540)
        verticalContainer.style['display'] = 'block'
        verticalContainer.style['overflow'] = 'hidden'

        horizontalContainer = gui.Widget(width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px')
        horizontalContainer.style['display'] = 'block'
        horizontalContainer.style['overflow'] = 'auto'
        
        subContainerLeft = gui.Widget(width=320)
        subContainerLeft.style['display'] = 'block'
        subContainerLeft.style['overflow'] = 'auto'
        subContainerLeft.style['text-align'] = 'center'
        self.img = gui.Image('/res/logo.png', width=100, height=100, margin='10px')
        self.img.set_on_click_listener(self, 'on_img_clicked')

        self.table = gui.Table(width=300, height=200, margin='10px')
        self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'],
                                   ['101', 'Danny', 'Young'],
                                   ['102', 'Christine', 'Holand'],
                                   ['103', 'Lars', 'Gordon'],
                                   ['104', 'Roberto', 'Robitaille'],
                                   ['105', 'Maria', 'Papadopoulos']])

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget()
        subContainerRight.style['width'] = '220px'
        subContainerRight.style['display'] = 'block'
        subContainerRight.style['overflow'] = 'auto'
        subContainerRight.style['text-align'] = 'center'
        self.count = 0
        self.counter = gui.Label('', width=200, height=30, margin='10px')

        self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px')

        self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self, 'on_button_pressed')

        self.txt = gui.TextInput(width=200, height=30, margin='10px')
        self.txt.set_text('This is a TEXTAREA')
        self.txt.set_on_change_listener(self, 'on_text_area_change')

        self.spin = gui.SpinBox(100, width=200, height=30, margin='10px')
        self.spin.set_on_change_listener(self, 'on_spin_change')

        self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px')
        self.check.set_on_change_listener(self, 'on_check_change')

        self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px')
        self.btInputDiag.set_on_click_listener(self, 'open_input_dialog')

        self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px')
        self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog')

        self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px')
        self.btUploadFile.set_on_success_listener(self, 'fileupload_on_success')
        self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed')

        items = ('Danny Young','Christine Holand','Lars Gordon','Roberto Robitaille')
        self.listView = gui.ListView.new_from_list(items, width=300, height=120, margin='10px')
        self.listView.set_on_selection_listener(self, "list_view_on_selected")

        self.link = gui.Link("http://localhost:8081", "A link to here", width=200, height=30, margin='10px')

        self.dropDown = gui.DropDown(width=200, height=20, margin='10px')
        c0 = gui.DropDownItem('DropDownItem 0', width=200, height=20)
        c1 = gui.DropDownItem('DropDownItem 1', width=200, height=20)
        self.dropDown.append(c0)
        self.dropDown.append(c1)
        self.dropDown.set_on_change_listener(self, 'drop_down_changed')
        self.dropDown.set_value('DropDownItem 0')

        self.slider = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px')
        self.slider.set_on_change_listener(self, 'slider_changed')

        self.colorPicker = gui.ColorPicker('#ffbb00', width=200, height=20, margin='10px')
        self.colorPicker.set_on_change_listener(self, 'color_picker_changed')

        self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px')
        self.date.set_on_change_listener(self, 'date_changed')

        self.video = gui.VideoPlayer('http://www.w3schools.com/tags/movie.mp4',
                                     'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg',
                                     width=300, height=270, margin='10px')
        # appending a widget to another, the first argument is a string key
        subContainerRight.append(self.counter)
        subContainerRight.append(self.lbl)
        subContainerRight.append(self.bt)
        subContainerRight.append(self.txt)
        subContainerRight.append(self.spin)
        subContainerRight.append(self.check)
        subContainerRight.append(self.btInputDiag)
        subContainerRight.append(self.btFileDiag)
        # use a defined key as we replace this widget later
        fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px')
        subContainerRight.append(fdownloader, key='file_downloader')
        subContainerRight.append(self.btUploadFile)
        subContainerRight.append(self.dropDown)
        subContainerRight.append(self.slider)
        subContainerRight.append(self.colorPicker)
        subContainerRight.append(self.date)
        self.subContainerRight = subContainerRight

        subContainerLeft.append(self.img)
        subContainerLeft.append(self.table)
        subContainerLeft.append(self.listView)
        subContainerLeft.append(self.link)
        subContainerLeft.append(self.video)

        horizontalContainer.append(subContainerLeft)
        horizontalContainer.append(subContainerRight)

        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('File', width=100, height=30)
        m2 = gui.MenuItem('View', width=100, height=30)
        m2.set_on_click_listener(self, 'menu_view_clicked')
        m11 = gui.MenuItem('Save', width=100, height=30)
        m12 = gui.MenuItem('Open', width=100, height=30)
        m12.set_on_click_listener(self, 'menu_open_clicked')
        m111 = gui.MenuItem('Save', width=100, height=30)
        m111.set_on_click_listener(self, 'menu_save_clicked')
        m112 = gui.MenuItem('Save as', width=100, height=30)
        m112.set_on_click_listener(self, 'menu_saveas_clicked')
        m3 = gui.MenuItem('Dialog', width=100, height=30)
        m3.set_on_click_listener(self, 'menu_dialog_clicked')

        menu.append(m1)
        menu.append(m2)
        menu.append(m3)
        m1.append(m11)
        m1.append(m12)
        m11.append(m111)
        m11.append(m112)

        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        verticalContainer.append(menubar)
        verticalContainer.append(horizontalContainer)

        # kick of regular display of counter
        self.display_counter()

        # returning the root widget
        return verticalContainer
Example #6
0
 def test_init(self):
     widget = gui.Date()
     assertValidHTML(widget.repr())
Example #7
0
    def main(self):
        """ GUI contains two vertical containers: Menu at top and all other widgets underneath
            It also contains three horizontal containers:
            Left one contains subject name widget, date, remarks & instructions.
            Middle containers is devoted for table with results.
            Right containers contains the analyze button and data visualization"""

        vertical_container = gui.Widget(width=1050,
                                        margin='0px auto',
                                        style={
                                            'display': 'block',
                                            'overflow': 'hidden'
                                        })
        horizontal_container = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })

        sub_container_left = gui.Widget(width=300,
                                        style={
                                            'display': 'block',
                                            'overflow': 'auto',
                                            'text-align': 'center'
                                        })
        sub_container_right = gui.Widget(width=400,
                                         style={
                                             'display': 'block',
                                             'overflow': 'auto',
                                             'text-align': 'center'
                                         })
        sub_container_instructions = gui.Widget(width=250,
                                                height=450,
                                                margin='10px',
                                                style={
                                                    'display': 'block',
                                                    'overflow': 'auto',
                                                    'text-align': 'left'
                                                })
        """ Subject's number:"""
        self.txt_subject = gui.TextInput(width=230, height=35, margin='1px')
        self.txt_subject.set_text("Subject number")
        self.txt_subject.style['font-size'] = '18px'
        self.txt_subject.style['background'] = 'lightgreen'
        self.txt_subject.style['text-align'] = 'center'
        """ Date: """
        self.date_headline = gui.Label('Acquisition date:',
                                       width=230,
                                       height=20,
                                       margin='1px')
        self.date_headline.style['text-align'] = 'left'
        self.date = gui.Date('2018-01-01', width=230, height=30, margin='1px')
        self.date.style['font-size'] = '16px'
        """ Remarks box: """
        self.txt = gui.TextInput(width=230, height=70, margin='1px')
        self.txt.set_text('Add remarks here')
        """ Instructions: """
        inst1 = gui.Label('Instructions:', width=230, height=25, margin='0px')
        inst1.style['font-size'] = '16px'
        inst1.style['background'] = 'lightgray'
        inst2 = gui.Label("1. Set subject's number and acquisition date",
                          width=230,
                          height=45,
                          margin='0px')
        inst2.style['background'] = 'lightgray'
        inst3 = gui.Label(
            "2. Load files: subject's map file, wanted mask and general population data (mean, sd & template)",
            width=230,
            height=80,
            margin='0px')
        inst3.style['background'] = 'lightgray'
        inst4 = gui.Label("3. Press 'Analyze' button",
                          width=230,
                          height=25,
                          margin='0px')
        inst4.style['background'] = 'lightgray'
        inst5 = gui.Label("4. Export your report",
                          width=230,
                          height=25,
                          margin='0px')
        inst5.style['background'] = 'lightgray'

        sub_container_instructions.append([
            self.txt_subject, self.date_headline, self.date, self.txt, inst1,
            inst2, inst3, inst4, inst5
        ])
        """ Create Table: """
        self.table = gui.Table.new_from_list(
            [['Region', 'value', 'Z-score'],
             ['Prefrontal Lateral R', '80', '1.2'],
             ['Prefrontal Lateral L', '25', '1.99'],
             ['Sensorimotor R', '76', '0.23'],
             ['Sensorimotor L', '88', '2.55']],
            width=250,
            height=500,
            margin='10px')

        sub_container_left.append(self.table, key='table')
        """ Logo: """
        sagol_logo = gui.Image(r'/res/Sagollogo.png',
                               width=300,
                               height=60,
                               margin='25px')
        sagol_logo.style['background'] = 'white'
        """ Analyze button: """
        self.bt_analyze = gui.Button("Analyze",
                                     width=350,
                                     height=30,
                                     margin='16px')
        self.bt_analyze.onclick.connect(self.on_analyze_pressed)
        """ Figure which be replace to visualized results: """
        self.figure_analyzed = gui.Image(r'/res/es.jpg',
                                         width=350,
                                         height=300,
                                         margin='10px')

        sub_container_right.append([sagol_logo, self.bt_analyze])
        sub_container_right.append(self.figure_analyzed, key='image')

        self.sub_container_left = sub_container_left
        self.sub_container_right = sub_container_right
        self.instructions = sub_container_instructions

        horizontal_container.append([
            self.instructions, self.sub_container_left,
            self.sub_container_right
        ])
        """ Menu: """
        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('Select Subject', width=100, height=30)
        m1.onclick.connect(self.menu_subject_clicked)
        m2 = gui.MenuItem('Properties', width=100, height=30)
        m3 = gui.MenuItem("Export as", width=100, height=30)
        m21 = gui.MenuItem('Select Mask', width=200, height=30)
        m21.onclick.connect(self.menu_mask_clicked)
        m22 = gui.MenuItem('General population data', width=200, height=30)
        m31 = gui.MenuItem('PDF', width=100, height=30)
        m31.onclick.connect(self.menu_pdf_clicked)
        m221 = gui.MenuItem('Select mean data', width=100, height=30)
        m221.onclick.connect(self.menu_mean_clicked)
        m222 = gui.MenuItem('Select SD data', width=100, height=30)
        m222.onclick.connect(self.menu_sd_clicked)
        m223 = gui.MenuItem('Select template', width=100, height=30)
        m223.onclick.connect(self.menu_template_clicked)
        menu.append([m1, m2, m3])
        m2.append([m21, m22])
        m3.append([m31])
        m22.append([m221, m222, m223])

        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        vertical_container.append([menubar, horizontal_container])

        return vertical_container
Example #8
0
    def main(self):
        # the margin 0px auto centers the main container
        verticalContainer = gui.Container(width=540, margin='0px auto', style={'display': 'block', 'overflow': 'hidden'})

        horizontalContainer = gui.Container(width='100%', layout_orientation=gui.Container.LAYOUT_HORIZONTAL, margin='0px', style={'display': 'block', 'overflow': 'auto'})

        subContainerLeft = gui.Container(width=320, style={'display': 'block', 'overflow': 'auto', 'text-align': 'center'})
        self.img = gui.Image('/res:logo.png', height=100, margin='10px')
        self.img.onclick.do(self.on_img_clicked)

        self.table = gui.Table.new_from_list([('ID', 'First Name', 'Last Name'),
                                              ('101', 'Danny', 'Young'),
                                              ('102', 'Christine', 'Holand'),
                                              ('103', 'Lars', 'Gordon'),
                                              ('104', 'Roberto', 'Robitaille'),
                                              ('105', 'Maria', 'Papadopoulos')], width=300, height=200, margin='10px')
        self.table.on_table_row_click.do(self.on_table_row_click)

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Container(style={'width': '220px', 'display': 'block', 'overflow': 'auto', 'text-align': 'center'})
        self.count = 0
        self.counter = gui.Label('', width=200, height=30, margin='10px')

        self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px')

        self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
        # setting the listener for the onclick event of the button
        self.bt.onclick.do(self.on_button_pressed)

        self.txt = gui.TextInput(width=200, height=30, margin='10px')
        self.txt.set_text('This is a TEXTAREA')
        self.txt.onchange.do(self.on_text_area_change)

        self.spin = gui.SpinBox(1, 0, 100, width=200, height=30, margin='10px')
        self.spin.onchange.do(self.on_spin_change)

        self.progress = gui.Progress(1, 100, width=200, height=5)

        self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px')
        self.check.onchange.do(self.on_check_change)

        self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px')
        self.btInputDiag.onclick.do(self.open_input_dialog)

        self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px')
        self.btFileDiag.onclick.do(self.open_fileselection_dialog)

        self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px')
        self.btUploadFile.onsuccess.do(self.fileupload_on_success)
        self.btUploadFile.onfailed.do(self.fileupload_on_failed)

        items = ('Danny Young','Christine Holand','Lars Gordon','Roberto Robitaille')
        self.listView = gui.ListView.new_from_list(items, width=300, height=120, margin='10px')
        self.listView.onselection.do(self.list_view_on_selected)

        self.link = gui.Link("http://localhost:8081", "A link to here", width=200, height=30, margin='10px')

        self.dropDown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'),
                                                   width=200, height=20, margin='10px')
        self.dropDown.onchange.do(self.drop_down_changed)
        self.dropDown.select_by_value('DropDownItem 0')

        self.slider = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px')
        self.slider.onchange.do(self.slider_changed)

        self.colorPicker = gui.ColorPicker('#ffbb00', width=200, height=20, margin='10px')
        self.colorPicker.onchange.do(self.color_picker_changed)

        self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px')
        self.date.onchange.do(self.date_changed)

        self.video = gui.Widget( _type='iframe', width=290, height=200, margin='10px')
        self.video.attributes['src'] = "https://drive.google.com/file/d/0B0J9Lq_MRyn4UFRsblR3UTBZRHc/preview"
        self.video.attributes['width'] = '100%'
        self.video.attributes['height'] = '100%'
        self.video.attributes['controls'] = 'true'
        self.video.style['border'] = 'none'

        self.tree = gui.TreeView(width='100%', height=300)
        ti1 = gui.TreeItem("Item1")
        ti2 = gui.TreeItem("Item2")
        ti3 = gui.TreeItem("Item3")
        subti1 = gui.TreeItem("Sub Item1")
        subti2 = gui.TreeItem("Sub Item2")
        subti3 = gui.TreeItem("Sub Item3")
        subti4 = gui.TreeItem("Sub Item4")
        subsubti1 = gui.TreeItem("Sub Sub Item1")
        subsubti2 = gui.TreeItem("Sub Sub Item2")
        subsubti3 = gui.TreeItem("Sub Sub Item3")
        self.tree.append([ti1, ti2, ti3])
        ti2.append([subti1, subti2, subti3, subti4])
        subti4.append([subsubti1, subsubti2, subsubti3])

        # appending a widget to another, the first argument is a string key
        subContainerRight.append([self.counter, self.lbl, self.bt, self.txt, self.spin, self.progress, self.check, self.btInputDiag, self.btFileDiag])
        # use a defined key as we replace this widget later
        fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px')
        subContainerRight.append(fdownloader, key='file_downloader')
        subContainerRight.append([self.btUploadFile, self.dropDown, self.slider, self.colorPicker, self.date, self.tree])
        self.subContainerRight = subContainerRight

        subContainerLeft.append([self.img, self.table, self.listView, self.link, self.video])

        horizontalContainer.append([subContainerLeft, subContainerRight])

        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('File', width=100, height=30)
        m2 = gui.MenuItem('View', width=100, height=30)
        m2.onclick.do(self.menu_view_clicked)
        m11 = gui.MenuItem('Save', width=100, height=30)
        m12 = gui.MenuItem('Open', width=100, height=30)
        m12.onclick.do(self.menu_open_clicked)
        m111 = gui.MenuItem('Save', width=100, height=30)
        m111.onclick.do(self.menu_save_clicked)
        m112 = gui.MenuItem('Save as', width=100, height=30)
        m112.onclick.do(self.menu_saveas_clicked)
        m3 = gui.MenuItem('Dialog', width=100, height=30)
        m3.onclick.do(self.menu_dialog_clicked)

        menu.append([m1, m2, m3])
        m1.append([m11, m12])
        m11.append([m111, m112])

        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        verticalContainer.append([menubar, horizontalContainer])

        #this flag will be used to stop the display_counter Timer
        self.stop_flag = False

        # kick of regular display of counter
        self.display_counter()

        # returning the root widget
        return verticalContainer
Example #9
0
    def main(self):
        verticalContainer = gui.Widget(640, 680, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        horizontalContainer = gui.Widget(620, 620,
                                         gui.Widget.LAYOUT_HORIZONTAL, 10)

        subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10)
        self.img = gui.Image(100, 100, './res/logo.png')

        self.table = gui.Table(300, 200)
        row = gui.TableRow()
        item = gui.TableTitle()
        item.append(str(id(item)), 'ID')
        row.append(str(id(item)), item)
        item = gui.TableTitle()
        item.append(str(id(item)), 'First Name')
        row.append(str(id(item)), item)
        item = gui.TableTitle()
        item.append(str(id(item)), 'Last Name')
        row.append(str(id(item)), item)
        self.table.append(str(id(row)), row)
        self.add_table_row(self.table, '101', 'Danny', 'Young')
        self.add_table_row(self.table, '102', 'Christine', 'Holand')
        self.add_table_row(self.table, '103', 'Lars', 'Gordon')
        self.add_table_row(self.table, '104', 'Roberto', 'Robitaille')
        self.add_table_row(self.table, '105', 'Maria', 'Papadopoulos')

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        self.lbl = gui.Label(200, 30, 'This is a LABEL!')

        self.bt = gui.Button(200, 30, 'Press me!')
        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self, 'on_button_pressed')

        self.txt = gui.TextInput(200, 30)
        self.txt.set_text('This is a TEXTAREA')
        self.txt.set_on_change_listener(self, 'on_text_area_change')

        self.spin = gui.SpinBox(200, 30, 100)
        self.spin.set_on_change_listener(self, 'on_spin_change')

        self.btInputDiag = gui.Button(200, 30, 'Open InputDialog')
        self.btInputDiag.set_on_click_listener(self, 'open_input_dialog')

        self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog')
        self.btFileDiag.set_on_click_listener(self,
                                              'open_fileselection_dialog')

        self.btUploadFile = gui.FileUploader(200, 30, './')
        self.btUploadFile.set_on_success_listener(self,
                                                  'fileupload_on_success')
        self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed')

        self.listView = gui.ListView(300, 120)
        self.listView.set_on_selection_listener(self, "list_view_on_selected")
        li0 = gui.ListItem(279, 20, 'Danny Young')
        li1 = gui.ListItem(279, 20, 'Christine Holand')
        li2 = gui.ListItem(279, 20, 'Lars Gordon')
        li3 = gui.ListItem(279, 20, 'Roberto Robitaille')
        self.listView.append('0', li0)
        self.listView.append('1', li1)
        self.listView.append('2', li2)
        self.listView.append('3', li3)

        self.dropDown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.dropDown.append('0', c0)
        self.dropDown.append('1', c1)
        self.dropDown.set_on_change_listener(self, 'drop_down_changed')
        self.dropDown.set_value('DropDownItem 0')

        self.slider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.slider.set_on_change_listener(self, 'slider_changed')

        self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00')
        self.colorPicker.set_on_change_listener(self, 'color_picker_changed')

        self.date = gui.Date(200, 20, '2015-04-13')
        self.date.set_on_change_listener(self, 'date_changed')

        # appending a widget to another, the first argument is a string key
        subContainerRight.append('1', self.lbl)
        subContainerRight.append('2', self.bt)
        subContainerRight.append('3', self.txt)
        subContainerRight.append('4', self.spin)
        subContainerRight.append('5', self.btInputDiag)
        subContainerRight.append('5_', self.btFileDiag)
        subContainerRight.append(
            '5__',
            gui.FileDownloader(200, 30, 'download test',
                               '../remi/res/logo.png'))
        subContainerRight.append('5___', self.btUploadFile)
        subContainerRight.append('6', self.dropDown)
        subContainerRight.append('7', self.slider)
        subContainerRight.append('8', self.colorPicker)
        subContainerRight.append('9', self.date)
        self.subContainerRight = subContainerRight

        subContainerLeft.append('0', self.img)
        subContainerLeft.append('1', self.table)
        subContainerLeft.append('2', self.listView)

        horizontalContainer.append('0', subContainerLeft)
        horizontalContainer.append('1', subContainerRight)

        menu = gui.Menu(620, 30)
        m1 = gui.MenuItem(100, 30, 'File')
        m2 = gui.MenuItem(100, 30, 'View')
        m2.set_on_click_listener(self, 'menu_view_clicked')
        m11 = gui.MenuItem(100, 30, 'Save')
        m12 = gui.MenuItem(100, 30, 'Open')
        m12.set_on_click_listener(self, 'menu_open_clicked')
        m111 = gui.MenuItem(100, 30, 'Save')
        m111.set_on_click_listener(self, 'menu_save_clicked')
        m112 = gui.MenuItem(100, 30, 'Save as')
        m112.set_on_click_listener(self, 'menu_saveas_clicked')

        menu.append('1', m1)
        menu.append('2', m2)
        m1.append('11', m11)
        m1.append('12', m12)
        m11.append('111', m111)
        m11.append('112', m112)

        verticalContainer.append('0', menu)
        verticalContainer.append('1', horizontalContainer)

        # returning the root widget
        return verticalContainer
Example #10
0
    def __init__(self, app: 'LessonReplaceBotApp'):
        self.app = app

        super().__init__(width=ALL, height='92%')
        style = {
            'justify-content': 'flex-start',
            'align-items': 'stretch',
            'background-color': 'transparent',
        }
        vbox = gui.VBox(width=ALL, height=ALL)
        vbox.style.update(style)
        vbox.style.update({
            'background-image':
            "url('https://sch1210sz.mskobr.ru/attach_files/logo/IMG_7037.png')",
            'background-repeat': 'no-repeat',
            'background-position': 'right top',
        })
        date_box = gui.HBox()
        date_box.style.update(style)
        now_str = datetime.datetime.now().strftime('%Y-%m-%d')
        self.date_picker = gui.Date(now_str,
                                    width=WIDTH,
                                    height=HEIGHT,
                                    margin=MARGIN)
        self.date_picker.onchange.do(lambda w, e: self.refresh_table())
        date_box.append(gui.Label("Дата:", height=HEIGHT, margin=MARGIN))
        date_box.append(self.date_picker)
        vbox.append(date_box)
        vbox.append(gui.Label("Новая замена:", height=HEIGHT, margin=MARGIN))
        repl_box = gui.HBox()
        repl_box.style.update(style)
        repl_box.append(gui.Label("Класс:", height=HEIGHT, margin=MARGIN))
        self.dd_class_no = gui.DropDown.new_from_list(
            [str(i) for i in range(1, 12)],
            height=HEIGHT,
            margin=MARGIN,
            width=MIN_WIDTH)
        repl_box.append(self.dd_class_no)
        rus_a = ord('А')
        self.dd_class_letter = gui.DropDown.new_from_list(
            [chr(i) for i in range(rus_a, rus_a + 32)],
            height=HEIGHT,
            margin=MARGIN,
            width=MIN_WIDTH)
        repl_box.append(self.dd_class_letter)
        repl_box.append(gui.Label("Урок:", height=HEIGHT, margin=MARGIN))
        self.dd_lesson_no = gui.DropDown.new_from_list(
            [str(i) for i in range(1, 11)],
            height=HEIGHT,
            margin=MARGIN,
            width=MIN_WIDTH)
        repl_box.append(self.dd_lesson_no)

        repl_box.append(gui.Label("Предмет:", height=HEIGHT, margin=MARGIN))
        self.dd_lesson = gui.DropDown(height=HEIGHT,
                                      margin=MARGIN,
                                      width=WIDTH)
        repl_box.append(self.dd_lesson)
        self.refresh_lesson_dd()

        repl_box.append(gui.Label("Учитель:", height=HEIGHT, margin=MARGIN))
        self.dd_teacher = gui.DropDown(height=HEIGHT,
                                       margin=MARGIN,
                                       width=WIDTH)
        repl_box.append(self.dd_teacher)
        self.refresh_teacher_dd()

        self.add_btn = gui.Button("Добавить",
                                  height=HEIGHT,
                                  width=WIDTH,
                                  margin=MARGIN)
        self.add_btn.onclick.do(self.on_add_btn_click)
        repl_box.append(self.add_btn)

        vbox.append(repl_box)
        vbox.append(
            gui.Label("Запланированные замены:", height=HEIGHT, margin=MARGIN))
        self.table = gui.Table(width='95%', margin=MARGIN)
        view_port = gui.Container(width=ALL,
                                  height=ALL,
                                  style={"overflow-y": "scroll"})
        view_port.append(self.table)
        vbox.append(view_port)
        self.refresh_table()
        self.append(vbox)
Example #11
0
    def __init__(self, *args):
        super(HistoryWidget, self).__init__(*args)
        self.css_width = "100%"
        self.container = gui.Container()
        self.container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
        self.events_hist_list = gui.ListView()
        self.unique_labels_list = gui.ListView()
        self.unique_rois_list = gui.ListView()

        self.container.append(self.events_hist_list)

        btn_class = "btn btn-primary"
        btn_css = css.HISTORY_SEARCH_STYLE

        self.search_history_btn = SButton("Search", "fa-search", btn_class)
        self.set_today_btn = SButton("Today", "fa-sun", btn_class, btn_css)
        self.set_prev_day_btn = SButton("", "fa-chevron-left", btn_class, btn_css)
        self.set_next_day_btn = SButton("", "fa-chevron-right", btn_class, btn_css)

        todays_date = datetime.now().strftime(DAY_FORMAT)
        self.search_from_date_widget = gui.Date(todays_date)
        self.search_to_date_widget = gui.Date(todays_date)
        self.filter_by_label_input = gui.TextInput()
        self.filter_by_label_input.set_text("*")
        self.search_info_lbl = gui.Label("")
        self.download_selected_btn = SButton(
            "Download selected", "fa-download", btn_class
        )
        self.select_all_btn = SButton("Select All", "fa-check-square", btn_class)
        self.deselect_all_btn = SButton("Deselect All", "fa-square", btn_class)
        self.reset_filters_btn = SButton("Reset", "fa-undo-alt", btn_class)
        self.apply_filters_btn = SButton("Filter", "fa-filter", btn_class)
        self.show_only_unique_events_btn = ToggleButton("Enable/Disable", style=btn_css)
        self.show_only_unique_events_btn.css_width = "100%"

        search_form = CustomFormWidget()
        search_form.css_width = "70%"
        search_form.add_field("from_day", "Search from", self.search_from_date_widget)
        search_form.add_field("to_day", "Search to", self.search_to_date_widget)
        search_form.add_field("by_label", "Filter by label", self.filter_by_label_input)
        search_form.add_field("only_unique", "Show only unique events", self.show_only_unique_events_btn)

        hbox = gui.HBox()
        hbox.css_display = "block"
        hbox.append(self.set_prev_day_btn)
        hbox.append(self.set_today_btn)
        hbox.append(self.set_next_day_btn)
        hbox.append(self.search_history_btn)

        search_form.add_field("controls", "", hbox)
        search_form.append(self.search_info_lbl)

        form_layout = gui.VBox()
        form_layout.append(search_form)

        controls_layout = gui.HBox()
        controls_layout.css_display = "block"
        controls_layout.append(self.download_selected_btn)
        controls_layout.append(self.select_all_btn)
        controls_layout.append(self.deselect_all_btn)
        controls_layout.append(self.apply_filters_btn)
        controls_layout.append(self.reset_filters_btn)

        self.hourly_hist_widget = HourlyToggleHistogram()
        self.style["padding"] = "0px 5px"
        self.append(HorizontalLine())
        self.append(form_layout)
        self.append(HorizontalLine())
        self.append(self.hourly_hist_widget)
        self.append(self.unique_rois_list)
        self.append(self.unique_labels_list)
        self.append(HorizontalLine())
        self.append(controls_layout)
        self.append(self.container)
        self.append(HorizontalLine())

        # signals:
        self.search_history_btn.onclick.do(self.update_events_history_list_thread)
        self.set_prev_day_btn.onclick.do(self.shift_search_dates, delta=-1)
        self.set_next_day_btn.onclick.do(self.shift_search_dates, delta=1)
        self.set_today_btn.onclick.do(self.set_today_date)
        self.download_selected_btn.onclick.do(self.on_download_images)
        self.select_all_btn.onclick.do(self.select_all_images)
        self.deselect_all_btn.onclick.do(self.deselect_all_images)
        self.reset_filters_btn.onclick.do(self.reset_filters)
        self.apply_filters_btn.onclick.do(self.apply_filters)
Example #12
0
    def main(self):
        verticalContainer = gui.Widget(640, 900, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        horizontalContainer = gui.Widget(620, 620,
                                         gui.Widget.LAYOUT_HORIZONTAL, 10)

        subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10)
        self.img = gui.Image(100, 100, '/res/logo.png')
        self.img.set_on_click_listener(self, 'on_img_clicked')

        self.table = gui.Table(300, 200)
        self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'],
                                   ['101', 'Danny', 'Young'],
                                   ['102', 'Christine', 'Holand'],
                                   ['103', 'Lars', 'Gordon'],
                                   ['104', 'Roberto', 'Robitaille'],
                                   ['105', 'Maria', 'Papadopoulos']])

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        self.count = 0
        self.counter = gui.Label(200, 30, '')

        self.lbl = gui.Label(200, 30, 'This is a LABEL!')

        self.bt = gui.Button(200, 30, 'Press me!')
        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self, 'on_button_pressed')

        self.txt = gui.TextInput(200, 30)
        self.txt.set_text('This is a TEXTAREA')
        self.txt.set_on_change_listener(self, 'on_text_area_change')

        self.spin = gui.SpinBox(200, 30, 100)
        self.spin.set_on_change_listener(self, 'on_spin_change')

        self.check = gui.CheckBoxLabel(200, 30, 'Label checkbox', True)
        self.check.set_on_change_listener(self, 'on_check_change')

        self.btInputDiag = gui.Button(200, 30, 'Open InputDialog')
        self.btInputDiag.set_on_click_listener(self, 'open_input_dialog')

        self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog')
        self.btFileDiag.set_on_click_listener(self,
                                              'open_fileselection_dialog')

        self.btUploadFile = gui.FileUploader(200, 30, './')
        self.btUploadFile.set_on_success_listener(self,
                                                  'fileupload_on_success')
        self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed')

        self.listView = gui.ListView(300, 120)
        self.listView.set_on_selection_listener(self, "list_view_on_selected")
        li0 = gui.ListItem(279, 20, 'Danny Young')
        li1 = gui.ListItem(279, 20, 'Christine Holand')
        li2 = gui.ListItem(279, 20, 'Lars Gordon')
        li3 = gui.ListItem(279, 20, 'Roberto Robitaille')
        self.listView.append('0', li0)
        self.listView.append('1', li1)
        self.listView.append('2', li2)
        self.listView.append('3', li3)

        self.link = gui.Link(200, 20, "http://localhost:8081",
                             "A link to here")

        self.dropDown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.dropDown.append('0', c0)
        self.dropDown.append('1', c1)
        self.dropDown.set_on_change_listener(self, 'drop_down_changed')
        self.dropDown.set_value('DropDownItem 0')

        self.slider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.slider.set_on_change_listener(self, 'slider_changed')

        self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00')
        self.colorPicker.set_on_change_listener(self, 'color_picker_changed')

        self.date = gui.Date(200, 20, '2015-04-13')
        self.date.set_on_change_listener(self, 'date_changed')

        self.video = gui.VideoPlayer(
            480, 270, 'http://www.w3schools.com/tags/movie.mp4',
            'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg'
        )

        # appending a widget to another, the first argument is a string key
        subContainerRight.append('0', self.counter)
        subContainerRight.append('1', self.lbl)
        subContainerRight.append('2', self.bt)
        subContainerRight.append('3', self.txt)
        subContainerRight.append('4', self.spin)
        subContainerRight.append('checkbox', self.check)
        subContainerRight.append('5', self.btInputDiag)
        subContainerRight.append('5_', self.btFileDiag)
        subContainerRight.append(
            '5__',
            gui.FileDownloader(200, 30, 'download test',
                               '../remi/res/logo.png'))
        subContainerRight.append('5___', self.btUploadFile)
        subContainerRight.append('6', self.dropDown)
        subContainerRight.append('7', self.slider)
        subContainerRight.append('8', self.colorPicker)
        subContainerRight.append('9', self.date)
        self.subContainerRight = subContainerRight

        subContainerLeft.append('0', self.img)
        subContainerLeft.append('1', self.table)
        subContainerLeft.append('2', self.listView)
        subContainerLeft.append('3', self.link)
        subContainerLeft.append('4', self.video)

        horizontalContainer.append('0', subContainerLeft)
        horizontalContainer.append('1', subContainerRight)

        menu = gui.Menu(620, 30)
        m1 = gui.MenuItem(100, 30, 'File')
        m2 = gui.MenuItem(100, 30, 'View')
        m2.set_on_click_listener(self, 'menu_view_clicked')
        m11 = gui.MenuItem(100, 30, 'Save')
        m12 = gui.MenuItem(100, 30, 'Open')
        m12.set_on_click_listener(self, 'menu_open_clicked')
        m111 = gui.MenuItem(100, 30, 'Save')
        m111.set_on_click_listener(self, 'menu_save_clicked')
        m112 = gui.MenuItem(100, 30, 'Save as')
        m112.set_on_click_listener(self, 'menu_saveas_clicked')
        m3 = gui.MenuItem(100, 30, 'Dialog')
        m3.set_on_click_listener(self, 'menu_dialog_clicked')

        menu.append('1', m1)
        menu.append('2', m2)
        menu.append('3', m3)
        m1.append('11', m11)
        m1.append('12', m12)
        m11.append('111', m111)
        m11.append('112', m112)

        menubar = gui.MenuBar(620, 30)
        menubar.append('1', menu)

        verticalContainer.append('0', menubar)
        verticalContainer.append('1', horizontalContainer)

        # kick of regular display of counter
        self.display_counter()

        # returning the root widget
        return verticalContainer
Example #13
0
    def main(self):
        verticalContainer = gui.Widget(width=1050,
                                       margin='0px auto',
                                       style={
                                           'display': 'block',
                                           'overflow': 'hidden'
                                       })
        horizontalContainer = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })
        subContainerLeft = gui.Widget(width=300,
                                      style={
                                          'display': 'block',
                                          'overflow': 'auto',
                                          'text-align': 'center'
                                      })
        subContainerRight = gui.Widget(width=400,
                                       style={
                                           'display': 'block',
                                           'overflow': 'auto',
                                           'text-align': 'center'
                                       })
        subContainerInstructions = gui.Widget(width=250,
                                              height=250,
                                              margin='10px',
                                              style={
                                                  'display': 'block',
                                                  'overflow': 'auto',
                                                  'text-align': 'left'
                                              })

        subContainerInstructions.style['background'] = 'lightgray'

        sagol_logo = gui.Image(r'/res/Sagollogo.png',
                               width=300,
                               height=60,
                               margin='25px')
        sagol_logo.style['background'] = 'white'
        inst1 = gui.Label('Instructions:', width=230, height=20, margin='10px')
        inst1.style['font-size'] = '16px'
        inst2 = gui.Label("1. Set subject's number and acquisition date",
                          width=230,
                          height=40,
                          margin='10px')
        inst3 = gui.Label(
            "2. Load files: subject's map file, wanted mask and general population data (mean, sd & template)",
            width=230,
            height=70,
            margin='10px')
        inst4 = gui.Label("3. Press 'Analyze' button",
                          width=230,
                          height=20,
                          margin='10px')
        inst5 = gui.Label("4. Export your report",
                          width=230,
                          height=20,
                          margin='10px')

        subContainerInstructions.append([inst1, inst2, inst3, inst4, inst5])

        self.txt_subject = gui.TextInput(width=250, height=35, margin='10px')
        self.txt_subject.set_text("Subject number")
        self.txt_subject.style['font-size'] = '16px'
        self.txt_subject.style['background'] = 'lightgreen'
        self.txt_subject.style['text-align'] = 'center'

        self.date_headline = gui.Label('Acquisition date:',
                                       width=250,
                                       height=20,
                                       margin='10px')
        self.date_headline.style['text-align'] = 'left'
        self.date = gui.Date('2018-01-01', width=250, height=30, margin='10px')
        self.date.style['font-size'] = '16px'

        self.txt = gui.TextInput(width=250, height=70, margin='10px')
        self.txt.set_text('Add remarks here')

        table_content = Table(subject_data).frame_to_list()
        self.table = gui.Table.new_from_list(
            [['Region', 'value', 'Z-score'],
             ['Prefrontal Lateral R', '80', '1.2'],
             ['Prefrontal Lateral L', '25', '1.99'],
             ['Sensorimotor R', '76', '0.23'],
             ['Sensorimotor L', '88', '2.55']],
            width=250,
            height=500,
            margin='10px')

        subContainerLeft.append([
            self.txt_subject, self.date_headline, self.date, self.txt,
            self.table
        ])
        self.bt_analyze = gui.Button("Analyze",
                                     width=350,
                                     height=30,
                                     margin='16px')
        #self.bt_analyze.onclick.connect(self.on_analyze_pressed)

        self.figure_analyzed = gui.Image(r'/res/es.jpg',
                                         width=350,
                                         height=300,
                                         margin='10px')
        subContainerRight.append(
            [sagol_logo, self.bt_analyze, self.figure_analyzed])
        self.sub_container_left = subContainerLeft
        self.sub_container_right = subContainerRight
        self.instructions = subContainerInstructions
        horizontalContainer.append([
            self.instructions, self.sub_container_left,
            self.sub_container_right
        ])

        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('Select Subject', width=100, height=30)
        m1.onclick.connect(self.menu_subject_clicked)
        m2 = gui.MenuItem('Properties', width=100, height=30)
        m3 = gui.MenuItem("Export as", width=100, height=30)
        m21 = gui.MenuItem('Select Mask', width=200, height=30)
        m21.onclick.connect(self.menu_mask_clicked)
        m22 = gui.MenuItem('General population data', width=200, height=30)
        m31 = gui.MenuItem('PDF', width=100, height=30)
        m31.onclick.connect(self.menu_pdf_clicked)
        m221 = gui.MenuItem('Select mean data', width=100, height=30)
        m221.onclick.connect(self.menu_mean_clicked)
        m222 = gui.MenuItem('Select SD data', width=100, height=30)
        m222.onclick.connect(self.menu_sd_clicked)
        m223 = gui.MenuItem('Select template', width=100, height=30)
        m223.onclick.connect(self.menu_template_clicked)
        menu.append([m1, m2, m3])
        m2.append([m21, m22])
        m3.append([m31])
        m22.append([m221, m222, m223])

        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        verticalContainer.append([menubar, horizontalContainer])

        return verticalContainer
    def main(self):
        # the margin 0px auto centers the main container
        verticalContainer = gui.Widget(width=540,
                                       margin='0px auto',
                                       style={
                                           'display': 'block',
                                           'overflow': 'hidden'
                                       })

        horizontalContainer = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })

        subContainerLeft = gui.Widget(width=320,
                                      style={
                                          'display': 'block',
                                          'overflow': 'auto',
                                          'text-align': 'center'
                                      })
        self.img = gui.Image(
            '/Users/robertbell/PycharmProjects/347Hub/remi-master/working/res/wildcat.png',
            height=100,
            margin='10px')
        self.img.set_on_click_listener(self.on_img_clicked)

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(
            style={
                'width': '220px',
                'display': 'block',
                'overflow': 'auto',
                'text-align': 'center'
            })
        self.count = 0
        self.counter = gui.Label('', width=200, height=30, margin='10px')

        self.lbl = gui.Label('This is a LABEL!',
                             width=200,
                             height=30,
                             margin='10px')

        self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self.on_button_pressed)

        self.txt = gui.TextInput(width=200, height=30, margin='10px')
        self.txt.set_text(
            os.path.join(os.path.dirname(os.path.abspath(__file__))))
        self.txt.set_on_change_listener(self.on_text_area_change)

        self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px')
        self.date.set_on_change_listener(self.date_changed)

        # appending a widget to another, the first argument is a string key
        subContainerRight.append([self.counter, self.lbl, self.bt, self.txt])
        # use a defined key as we replace this widget later
        fdownloader = gui.FileDownloader('download test',
                                         '../remi/res/logo.png',
                                         width=200,
                                         height=30,
                                         margin='10px')
        subContainerRight.append(fdownloader, key='file_downloader')
        subContainerRight.append([self.date])
        self.subContainerRight = subContainerRight

        subContainerLeft.append([self.img])

        horizontalContainer.append([subContainerLeft, subContainerRight])

        verticalContainer.append([horizontalContainer])

        # kick of regular display of counter
        self.display_counter()

        # returning the root widget
        return verticalContainer