Ejemplo n.º 1
0
    def main(self):

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

        self.rowList = []
        self.statuses = {}
        self.runUpdateTimer = True

        verticalContainer.append(self.buildGrid())
        self.updateRows()
        return verticalContainer
Ejemplo n.º 2
0
    def constructUI(self, **kwargs):

        card = gui.Container()
        card.add_class('w3-card-4 w3-margin w3-padding w3-white w3-display-middle w3-col l4 s12')
        card.style.update({'position': 'fixed'})        # Position is calculated dynamically but then the card stays fixed :-)
        self.append(card)

        title = gui.Container()
        title.add_child(key='title', value=f'<h4 class="w3-wide w3-center">{kwargs["title"]}</h2>')
        card.append(title)

        message = gui.Label(kwargs['message'])
        message.add_class('w3-small')
        card.append(message)

        ok = gui.Button('OK', style={'width': '30%'})
        ok.add_class('w3-button w3-green w3-left')
        ok.onclick.do(self.handle)

        cancel = gui.Button('Cancel', style={'width': '30%'})
        cancel.add_class('w3-button w3-yellow w3-right')
        cancel.onclick.do(self.handle)

        card.add_child(key='spacer', value='<br><br>')
        card.append(ok)
        card.append(cancel)
Ejemplo n.º 3
0
    def main(self):
        # the arguments are    width - height - layoutOrientationOrizontal
        self.main_container = gui.Container(margin='0px auto')
        self.main_container.set_size(1020, 600)
        self.main_container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)

        self.title = gui.Label('Mine Field GAME')
        self.title.set_size(1000, 30)
        self.title.style['margin'] = '10px'
        self.title.style['font-size'] = '25px'
        self.title.style['font-weight'] = 'bold'

        self.info = gui.Label('Collaborative minefiled game. Enjoy.')
        self.info.set_size(400, 30)
        self.info.style['margin'] = '10px'
        self.info.style['font-size'] = '20px'

        self.lblMineCount = gui.Label('Mines')
        self.lblMineCount.set_size(100, 30)
        self.lblFlagCount = gui.Label('Flags')
        self.lblFlagCount.set_size(100, 30)

        self.time_count = 0
        self.lblTime = gui.Label('Time')
        self.lblTime.set_size(100, 30)

        self.btReset = gui.Button('Restart')
        self.btReset.set_size(100, 30)
        self.btReset.onclick.do(self.new_game)

        self.horizontal_container = gui.Container()
        self.horizontal_container.style['display'] = 'block'
        self.horizontal_container.style['overflow'] = 'auto'
        self.horizontal_container.set_layout_orientation(gui.Container.LAYOUT_HORIZONTAL)
        self.horizontal_container.style['margin'] = '10px'
        self.horizontal_container.append(self.info)
        imgMine = gui.Image('/my_resources:mine.png')
        imgMine.set_size(30, 30)
        self.horizontal_container.append([imgMine, self.lblMineCount])
        imgFlag = gui.Image('/my_resources:flag.png')
        imgFlag.set_size(30, 30)
        self.horizontal_container.append([imgFlag, self.lblFlagCount, self.lblTime, self.btReset])

        self.minecount = 0  # mine number in the map
        self.flagcount = 0  # flag placed by the players

        self.link = gui.Link("https://github.com/dddomodossola/remi",
                             "This is an example of REMI gui library.")
        self.link.set_size(1000, 20)
        self.link.style['margin'] = '10px'

        self.main_container.append([self.title, self.horizontal_container, self.link])

        self.new_game(self)

        self.stop_flag = False
        self.display_time()
        # returning the root widget
        return self.main_container
Ejemplo n.º 4
0
    def main(self):
        verticalContainer = gui.Container(width='100%',
                                          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'
            })

        self.btn = gui.Button(text="okay")
        self.btn2 = gui.Button(text="nggak okay")
        self.btn3 = gui.Button(text='ini yang ketiga')
        self.container = gui.Container(
            width='100%',
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })
        self.h = Container(self)
        self.container.append(self.h)
        horizontalContainer.append(
            [self.btn, self.btn2, self.btn3, self.container])

        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('Rezky', 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)

        menu.append([m1])
        m1.append([m11, m12])

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

        return verticalContainer
Ejemplo n.º 5
0
def createContainer(w, h, cclass, orientation):
    if orientation == 'vertical':
        cont = gui.Container(width=w,
                             height=h,
                             layout_orientation=gui.Container.LAYOUT_VERTICAL)
    elif orientation == 'horizontal':
        cont = gui.Container(
            width=w,
            height=h,
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL)
    cont.add_class(cclass)

    return cont
Ejemplo n.º 6
0
    def main(self):

        self.init()

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

        subContainerLeft = gui.Container(width=self.width / 2,
                                         height=self.height / 2,
                                         style={
                                             'display': 'block',
                                             'overflow': 'auto',
                                             'text-align': 'center'
                                         })
        subContainerRight = gui.Container(width=self.width / 2,
                                          height=self.height / 2,
                                          style={
                                              'display': 'block',
                                              'overflow': 'auto',
                                              'text-align': 'center'
                                          })

        self.img = gui.Image('/res:logo.png', height=100, margin='10px')

        # self.add("logger",MyTextBox(width='80%', height='100%',single_line=False))
        self.add("menu", Menu(root=self, width=self.width, height=30))
        self.main.append(horizontalContainer)

        # self.table = Table2(attributes = {'id':'table'})

        #http://127.0.0.1:8082/table/api_set_text?value1=text1&value2=text2

        # appending a widget to another, the first argument is a string key
        # wid.append(self.table)

        self.thread_alive_flag = True

        #Here I start a parallel thread that executes my algorithm for a long time
        t = threading.Thread(target=self.my_intensive_long_time_algorithm)
        t.start()

        # returning the root widget
        return self.main
Ejemplo n.º 7
0
    def main(self, name='world'):
        # the arguments are	width - height - layoutOrientationOrizontal
        self.mainContainer = gui.Container(width=640,
                                           height=270,
                                           margin='0px auto')
        self.mainContainer.style['text-align'] = 'center'
        self.image_widget = PILImageViewverWidget(width=200, height=200)

        self.menu = gui.Menu(width=620, height=30)
        m1 = gui.MenuItem('File', width=100, height=30)
        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)

        self.menu.append(m1)
        m1.append(m11)
        m1.append(m12)
        m11.append(m111)
        m11.append(m112)

        self.mainContainer.append(self.menu)
        self.mainContainer.append(self.image_widget)

        # returning the root widget
        return self.mainContainer
Ejemplo n.º 8
0
    def construct_tabview(self):
        # make tab bar as wide as the frame
        if self.bar_width < self.frame_width:
            blank_width = self.frame_width - self.bar_width
            but = gui.Button('', width=blank_width, height=self.bar_height)
            self.tab_bar.append(but, key='xxblank')
            self.bar_width = self.frame_width

        self.tab_bar.style['width'] = gui.to_pix(self.bar_width)
        self.tab_title = gui.Label('fred',
                                   width=self.frame_width - 30,
                                   height=20)
        self.tab_title.style['margin'] = '2px'

        # frame for the tab panel, different tabs are switched into this frame.
        self.tab_frame = gui.Container(width=self.frame_width,
                                       height=self.frame_height)  #0
        self.tab_frame.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)

        # add the bar, panels and title to the subclassed Widget
        self.append(self.tab_bar, key='tab_bar')
        self.append(self.tab_title, key='tab_title')
        self.append(self.tab_frame, key='tab_frame')
        self.set_size(self.bar_width, self.frame_height + 100)
        return self
Ejemplo n.º 9
0
 def add_tab(self, w, key, title):
     tab_button = self._tab_button(w, self.bar_height, title, 'button', key)
     self.bar_width += w
     self.tab_bar.append(tab_button, key=key)
     panel_obj = gui.Container(width=self.frame_width,
                               height=self.frame_height)  #0
     panel_obj.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
     self.panel_obj[key] = panel_obj
     self.tab_titles[key] = title
     # print 'add tab',title,key,panel_obj
     return panel_obj
Ejemplo n.º 10
0
 def __init__(self, labels_min_width: str = "40%", *args):
     super(CustomFormWidget, self).__init__(*args)
     self.inputs = {}
     self.container = gui.Container()
     self.container.style.update({
         "display": "block",
         "overflow": "auto",
         "margin": "5px"
     })
     self.css_margin = "5px"
     self.css_labels_min_width = labels_min_width
     self.container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
     self.append(self.container)
Ejemplo n.º 11
0
    def __init__(self, title_widget: gui.Widget, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.set_style({"display": "contents"})
        title_widget.add_class("dropdown-toggle")
        title_widget.attributes["data-toggle"] = "dropdown"
        self.append(title_widget)

        menu = gui.Container()
        menu.add_class("dropdown-menu")

        self.menu = menu
        self.append(menu)
Ejemplo n.º 12
0
    def __init__(self,
                 button_label='siemens button',
                 db_index=-1,
                 byte_index=-1,
                 bit_index=-1,
                 toggle=False,
                 *args,
                 **kwargs):
        self.color_inactive = 'darkgray'
        self.color_active = 'rgb(0,255,0)'
        _style = style_inheritance_text_dict
        _style.update(style_inheritance_dict)
        self.button = gui.Button(button_label,
                                 width="100%",
                                 height="100%",
                                 style=_style)
        self.led = gui.Widget(width=15,
                              height=5,
                              style={
                                  'position': 'absolute',
                                  'left': '2px',
                                  'top': '2px',
                                  'background-color': self.color_inactive
                              })
        self.led_status = False
        default_style = {
            'position': 'absolute',
            'left': '10px',
            'top': '10px',
            'background-color': 'rgb(4, 90, 188)',
            'color': 'white'
        }
        default_style.update(kwargs.get('style', {}))
        kwargs['style'] = default_style
        kwargs['width'] = kwargs['style'].get('width',
                                              kwargs.get('width', '100px'))
        kwargs['height'] = kwargs['style'].get('height',
                                               kwargs.get('height', '100px'))
        super(SiemensButton, self).__init__(*args, **kwargs)
        _style = {'position': 'relative'}
        _style.update(style_inheritance_dict)
        self.append(
            gui.Container(children=[self.button, self.led],
                          width="100%",
                          height="100%",
                          style=_style))
        self.toggle = toggle

        self.button.onmousedown.do(self.set_bit)
        self.button.onmouseup.do(self.reset_bit)
Ejemplo n.º 13
0
def append_with_label(parent, text, field, button, width=300, key=''):
    fields_spacing = 5  #horizontal spacing
    field_height = int(gui.from_pix(field.style['height']))
    field_width = int(gui.from_pix(field.style['width']))
    label = gui.Label(text,
                      width=width - field_width - 3 * fields_spacing - 20,
                      height=field_height)
    _container = gui.Container(width=width, height=field_height)
    _container.set_layout_orientation(gui.Container.LAYOUT_HORIZONTAL)
    _container.style['margin'] = '4px'
    _container.append(label, key='lbl' + str(key))
    _container.append(field, key='field' + str(key))
    if button is not None:
        _container.append(button, key='button' + str(key))
    parent.append(_container, key=key)
Ejemplo n.º 14
0
 def buildGrid(self):
     vbox = gui.Container(width='100%',
                          height='100%',
                          margin='0px',
                          style={
                              'display': 'block',
                              'overflow': 'auto'
                          })
     headerContainer = self.buildRow('Device', 'Status', header=True)
     vbox.append(headerContainer)
     for rule in rules:
         row = self.buildRow(rule, 'Open')
         self.rowList.append(row)
         vbox.append(row)
     return vbox
Ejemplo n.º 15
0
    def __init__(self,
                 title="CSinSchools Application",
                 width="100%",
                 height="100%"):
        if title is None or len(title) == 0:
            raise Exception("Please supply a title for the application.")
        self.events = []
        self.initialised = False

        CSinSCApp.title = title

        self.container = gui.Container(width=width, height=height)
        self.container.style["display"] = "flex;"
        self.container.style["justify-content"] = "center;"
        self.container.style["align-items"] = "top;"

        self.thread_id = None
Ejemplo n.º 16
0
    def main(self):
        self.floatingPaneContainer = FloatingPanesContainer(width=800, height=600, margin='0px auto')
        self.floatingPaneContainer.append(gui.Label("Click a panel to select, than drag and stretch"))

        pane1 = gui.Container(width=100, height=200)
        pane1.style['background-color'] = 'yellow'
        self.floatingPaneContainer.add_pane(pane1, 10, 100)
        pane1.append(gui.Label("Panel1, drag and stretch"))

        pane2 = gui.VBox(width=100, height=200)
        pane2.style['background-color'] = 'green'
        self.floatingPaneContainer.add_pane(pane2, 150, 100)
        pane2.append(gui.Label("Panel2, drag and stretch"))
        

        # returning the root widget
        return self.floatingPaneContainer
Ejemplo n.º 17
0
    def main(self):

        self.mainContainer = gui.Container(width='95%',
                                           margin='0px auto',
                                           style={
                                               'display': 'block',
                                               'overflow': 'hidden'
                                           })

        #variable for controlling whether classifier information is shown or gold info
        self.classifier = False
        self.date = 2

        self.loginBox = gui.VBox(
            width="50%",
            margin="10px auto 20px",
        )
        self.loginBox.css_background_color = 'cyan'
        self.loginBox.style['padding'] = "2%"

        heading = gui.Label("Discussion Tracker App", margin="5px  auto")
        userBox = gui.Input(width=200, height=15, margin="5px  auto")
        userBox.attributes['placeholder'] = "username"
        userBox.set_on_key_up_listener(self.formEnterUp)
        passBox = gui.Input(input_type='password',
                            width=200,
                            height=15,
                            margin="5px  auto")
        passBox.attributes['placeholder'] = "password"
        passBox.set_on_key_up_listener(self.formEnterUp)

        button = gui.Button("Login", margin="5px  auto")
        button.onclick.do(self.addContent)

        self.loginBox.append({
            'head': heading,
            'user': userBox,
            'pass': passBox,
            'button': button
        })

        self.mainContainer.append(self.loginBox)

        #print(self.session)
        return self.mainContainer
Ejemplo n.º 18
0
    def init(self):
        self.width = 1100
        self.height = 800
        self.main = gui.Container(width=self.width,
                                  height=self.height,
                                  margin='0px auto',
                                  style={
                                      'display': 'block',
                                      'overflow': 'hidden'
                                  })

        #add the following 3 lines to your app and the on_window_close method to make the console close automatically
        tag = gui.Tag(_type='script')
        tag.add_child(
            "javascript",
            """window.onunload=function(e){sendCallback('%s','%s');return "close?";};"""
            % (str(id(self)), "on_window_close"))
        self.main.add_child("onunloadevent", tag)
Ejemplo n.º 19
0
    def __init__(self, frame_width, frame_height, bar_height, **kwargs):
        super(TabView, self).__init__(**kwargs)

        self.bar_width = 0
        self.bar_height = bar_height
        self.frame_width = frame_width
        self.frame_height = frame_height

        self.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)

        #dictionary to  lookup panel object given key
        self.panel_obj = dict()
        self.tab_titles = dict()

        #tab bar
        self.tab_bar = gui.Container(width=self.bar_width,
                                     height=self.bar_height)
        self.tab_bar.set_layout_orientation(gui.Container.LAYOUT_HORIZONTAL)
Ejemplo n.º 20
0
    def __init__(self, app: 'LessonReplaceBotApp', table: str, field: str,
                 onchange: Callable):
        self.app = app
        self.table = table
        self.field = field
        self.onchange = onchange

        super().__init__(width=ALL, height='92%')
        hbox = gui.HBox(width=ALL, height=ALL)

        left_panel = gui.VBox(width="30%", height=ALL, margin=MARGIN)
        left_panel.css_justify_content = "flex-start"
        right_panel = gui.VBox(width="70%", height=ALL, margin=MARGIN)

        self.text = gui.TextInput('', width=ALL, height=HEIGHT, margin=MARGIN)
        self.add_btn = gui.Button('Добавить',
                                  width=ALL,
                                  height=HEIGHT,
                                  margin=MARGIN)
        self.add_btn.onclick.do(self.on_btn_add_click)
        self.del_btn = gui.Button('Удалить',
                                  width=ALL,
                                  height=HEIGHT,
                                  margin=MARGIN)
        self.del_btn.set_enabled(False)

        left_panel.append(self.text)
        left_panel.append(self.add_btn)
        left_panel.append(self.del_btn)

        self.list_view = gui.ListView(width=ALL, height=ALL, margin=MARGIN)
        self.refresh_list()
        self.list_view.onselection.do(self.list_view_on_selected)
        view_port = gui.Container(width=ALL,
                                  height=ALL,
                                  style={"overflow-y": "scroll"})
        view_port.append(self.list_view)
        right_panel.append(view_port)

        hbox.append(left_panel)
        hbox.append(right_panel)
        self.append(hbox)
Ejemplo n.º 21
0
    def __init__(self,
                 title='',
                 message='',
                 confirm_name='',
                 cancel_name='',
                 frame_height=0,
                 *args,
                 **kwargs):
        """
        Args:
            title (str): The title of the dialog.
            message (str): The message description.
            kwargs: See Container.__init__()
        """
        super(AdaptableDialog, self).__init__(*args, **kwargs)
        self.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
        self.style.update({
            'display': 'block',
            'overflow': 'auto',
            'margin': '0px auto'
        })

        if len(title) > 0:
            t = gui.Label(title)
            t.add_class('DialogTitle')
            #t.css_font_weight='bold'
            self.append(t, "title")  ###

        if len(message) > 0:
            m = gui.Label(message)
            m.css_margin = '5px'
            self.append(m, "message")  ###

        # container for user widgets
        if frame_height != 0:
            self._container = gui.Container(height=frame_height)
        else:
            self._container = gui.Container()
        self._container.style.update({
            'display': 'block',
            'overflow': 'auto',
            'margin': '5px'
        })
        self._container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
        self.append(self._container, "central_container")  #moved

        if cancel_name != '' or confirm_name != '':
            hlay = gui.Container(height=35)
            hlay.css_display = 'block'
            hlay.style['overflow'] = 'visible'
            self.append(hlay, "buttons_container")

        if confirm_name != '':
            self.conf = gui.Button(confirm_name)
            self.conf.set_size(100, 30)
            self.conf.css_margin = '3px'
            self.conf.style['float'] = 'right'  #new
            hlay.append(self.conf, "confirm_button")
            self.conf.onclick.connect(self.confirm_dialog)

        if cancel_name != '':
            self.cancel = gui.Button(cancel_name)
            self.cancel.set_size(100, 30)
            self.cancel.css_margin = '3px'
            self.cancel.style['float'] = 'right'  #new
            hlay.append(self.cancel, "cancel_button")
            self.cancel.onclick.connect(self.cancel_dialog)

        self.inputs = {}
Ejemplo n.º 22
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)
    def addContent(self):
        #strength and weakness box
        swBox = DEFAULT_VISIBLE_CONTAINER()
        #swBox.attributes['width'] = '95%'
        swBox.style['width'] = '95%'
        swBox.style['margin'] = '10px auto'
        swBox.style['float'] = 'none'
        swBox.style['background-color'] = 'cyan'

        #Text one
        lblOne = gui.Label('1. Strengths and Weaknesses of the Discussion: ',
                           margin='1%')
        lblOne.style['background-color'] = 'white'
        swBox.append(lblOne)

        #grid of strenghts and weaknesses
        swGrid = gui.GridBox(width="98%", margin="10px 1% 20px")
        swGrid.style['float'] = 'none'
        grid = [['pos00', 'pos01']]
        swGrid.define_grid(grid)
        strength = gui.Container(width="100%",
                                 style={
                                     'background-color': 'palegreen',
                                     'padding': "10px 0px 10px"
                                 })
        weakness = gui.Container(width="100%",
                                 style={
                                     'background-color':
                                     'lightgoldenrodyellow',
                                     'padding': "10px 0px 10px"
                                 })

        strength.append(gui.Label("Strengths:"))
        strength.append(
            gui.Label("-%s" %
                      (self.strengths_text['Strengths'][self.userProfile.data[
                          int(self.userProfile.date - 1)]['strengths'][0]]),
                      style={'padding-left': '2%'}))
        strength.append(
            gui.Label("-%s" %
                      (self.strengths_text['Strengths'][self.userProfile.data[
                          int(self.userProfile.date - 1)]['strengths'][1]]),
                      style={'padding-left': '2%'}))
        weakness.append(gui.Label("Weaknesses:"))
        weakness.append(
            gui.Label("-%s" %
                      (self.strengths_text['Weaknesses'][self.userProfile.data[
                          int(self.userProfile.date - 1)]['weaknesses'][0]]),
                      style={'padding-left': '2%'}))
        weakness.append(
            gui.Label("-%s" %
                      (self.strengths_text['Weaknesses'][self.userProfile.data[
                          int(self.userProfile.date - 1)]['weaknesses'][1]]),
                      style={'padding-left': '2%'}))

        swGrid.append(strength, 'pos00')
        swGrid.append(weakness, 'pos01')
        swBox.append(swGrid)

        #creating the goal setting box
        gsBox = DEFAULT_VISIBLE_CONTAINER()
        gsBox.style['width'] = '95%'
        gsBox.style['margin'] = '10px auto'
        gsBox.style['float'] = 'none'
        gsBox.style['background-color'] = 'cyan'
        lblTwo = gui.Label(
            "2. Select a Goal for Improving the Next Student Discussion:",
            margin="1%",
            style={'background-color': 'white'})
        gsBox.append(lblTwo)

        radioBox = gui.VBox(width='98%', margin="10px 1% 20px")
        radioBox.style['display'] = 'block'
        self.gsRadio1 = RadioButtonWithLabel(self.strengths_text['Goals'][
            self.userProfile.getCurrentTranscript()['weaknesses'][0]],
                                             False,
                                             'groupGoal',
                                             margin="5px 0px",
                                             style={'padding-left': '1px'})
        self.gsRadio2 = RadioButtonWithLabel(self.strengths_text['Goals'][
            self.userProfile.getCurrentTranscript()['weaknesses'][1]],
                                             False,
                                             'groupGoal',
                                             margin="5px 0px",
                                             style={'padding-left': '1px'})
        #adding a custom field to know what shit is happening
        self.gsRadio1.idx = self.userProfile.data[int(self.userProfile.date -
                                                      1)]['weaknesses'][0]
        self.gsRadio2.idx = self.userProfile.data[int(self.userProfile.date -
                                                      1)]['weaknesses'][1]
        #enabling the action
        self.gsRadio1.onchange.do(self.radio_changed)
        self.gsRadio2.onchange.do(self.radio_changed)
        #selecting option
        self.selectButton()
        radioBox.append([self.gsRadio1, self.gsRadio2])
        #register the javascript code for selecting the button so it occurs on load to
        self.onload_functions_js.append(
            ('activate_radio_button', partial(self.selectButtonJS)))
        #self.onload_functions.append(('activate_radio_button', partial(self.selectButton)))
        gsBox.append(radioBox)

        #creating the box for the instructional resources
        isBox = DEFAULT_VISIBLE_CONTAINER()
        isBox.style['display'] = 'none'
        isBox.style['width'] = '95%'
        isBox.style['margin'] = '10px auto'
        isBox.style['float'] = 'none'
        isBox.style['background-color'] = 'cyan'
        lblThree = gui.Label(
            '3. Look at these instructional resources and incorporate them in your lessons before your next discussion:',
            margin='1%',
            style={'background-color': 'white'})
        isBox.append(lblThree)

        linkBox = gui.VBox(width="98%",
                           margin="10px 1% 20px",
                           style={"background-color": 'white'})
        linkBox.style['display'] = 'block'
        tTalk = gui.Label("Teacher Talk", margin="1px")
        tTalk.attributes['href'] = "/"
        tTalk.type = "a"
        mLess = gui.Label("Minilesson", margin="1px")
        mLess.attributes['href'] = "/"
        mLess.type = "a"
        acivi = gui.Label("Activity", margin="1px")
        acivi.attributes['href'] = "/"
        acivi.type = "a"
        linkBox.append(tTalk)
        linkBox.append(gui.Label(" "))
        linkBox.append(mLess)
        linkBox.append(gui.Label(" "))
        linkBox.append(acivi)
        self.isLinkKey = isBox.append(linkBox)
        self.page.append(swBox)
        self.page.append(gsBox)
        self.isKey = self.page.append(isBox)

        #activate the isBox if appropriate
        self.activateIS()
Ejemplo n.º 24
0
    def main(self):
        self.mainContainer = gui.Container(
            width='100%',
            height='100%',
            layout_orientation=gui.Container.LAYOUT_VERTICAL,
            style={
                'background-color': 'white',
                'border': 'none',
                'overflow': 'hidden'
            })

        menubar = gui.MenuBar(height='4%')
        menu = gui.Menu(width='100%', height='100%')
        menu.style['z-index'] = '1'
        m1 = gui.MenuItem('File', width=150, height='100%')
        m10 = gui.MenuItem('New', width=150, height=30)
        m11 = gui.MenuItem('Open', width=150, height=30)
        m12 = gui.MenuItem('Save Your App', width=150, height=30)
        #m12.style['visibility'] = 'hidden'
        m121 = gui.MenuItem('Save', width=100, height=30)
        m122 = gui.MenuItem('Save as', width=100, height=30)
        m123 = gui.MenuItem('Export widget as', width=200, height=30)
        m1.append([m10, m11, m12])
        m12.append([m121, m122, m123])

        m2 = gui.MenuItem('Edit', width=100, height='100%')
        m21 = gui.MenuItem('Cut', width=100, height=30)
        m22 = gui.MenuItem('Paste', width=100, height=30)
        m2.append([m21, m22])

        m3 = gui.MenuItem('Project Config', width=200, height='100%')

        m4 = gui.MenuItem('Became a Patron',
                          width=200,
                          height='100%',
                          style={'font-weight': 'bold'})

        menu.append([m1, m2, m3, m4])

        menubar.append(menu)

        self.toolbar = editor_widgets.ToolBar(width='100%',
                                              height='30px',
                                              margin='0px 0px')
        self.toolbar.style['border-bottom'] = '1px solid rgba(0,0,0,.12)'
        self.toolbar.add_command('/editor_resources:delete.png',
                                 self.toolbar_delete_clicked, 'Delete Widget')
        self.toolbar.add_command('/editor_resources:cut.png',
                                 self.menu_cut_selection_clicked, 'Cut Widget')
        self.toolbar.add_command('/editor_resources:paste.png',
                                 self.menu_paste_selection_clicked,
                                 'Paste Widget')

        lbl = gui.Label("Snap grid", width=100)
        spin_grid_size = gui.SpinBox('15', '1', '100', width=50)
        spin_grid_size.set_on_change_listener(self.on_snap_grid_size_change)

        grid_size = gui.HBox(children=[lbl, spin_grid_size],
                             style={
                                 'outline': '1px solid gray',
                                 'margin': '2px',
                                 'margin-left': '10px'
                             })
        self.toolbar.append(grid_size)

        self.fileOpenDialog = editor_widgets.EditorFileSelectionDialog(
            'Open Project',
            'Select the project file.<br>It have to be a python program created with this editor.',
            False, '.', True, False, self)
        self.fileOpenDialog.confirm_value.do(self.on_open_dialog_confirm)

        self.fileSaveAsDialog = editor_widgets.EditorFileSaveDialog(
            'Project Save', 'Select the project folder and type a filename',
            False, '.', False, True, self)
        self.fileSaveAsDialog.add_fileinput_field('untitled.py')
        self.fileSaveAsDialog.confirm_value.do(self.menu_save_clicked)

        m10.onclick.do(self.menu_new_clicked)
        m11.onclick.do(self.fileOpenDialog.show)
        m121.onclick.do(self.menu_save_clicked)
        m122.onclick.do(self.fileSaveAsDialog.show)
        m123.onclick.do(self.menu_save_widget_clicked)
        m21.onclick.do(self.menu_cut_selection_clicked)
        m22.onclick.do(self.menu_paste_selection_clicked)

        m3.onclick.do(self.menu_project_config_clicked)
        m4.onclick.do(self.menu_became_a_patron)

        self.subContainer = gui.HBox(
            width='100%',
            height='96%',
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL)
        self.subContainer.style.update({
            'position': 'relative',
            'overflow': 'hidden',
            'align-items': 'stretch'
        })

        # here are contained the widgets
        self.widgetsCollection = editor_widgets.WidgetCollection(self,
                                                                 width='100%',
                                                                 height='50%')

        self.projectConfiguration = editor_widgets.ProjectConfigurationDialog(
            'Project Configuration',
            'Write here the configuration for your project.')

        self.attributeEditor = editor_widgets.EditorAttributes(self,
                                                               width='100%')
        self.attributeEditor.style['overflow'] = 'hide'
        self.signalConnectionManager = editor_widgets.SignalConnectionManager(
            width='100%', height='50%', style={'order': '1'})

        self.mainContainer.append([menubar, self.subContainer])

        self.subContainerLeft = gui.VBox(width='20%', height='100%')
        self.subContainerLeft.style['position'] = 'relative'
        self.subContainerLeft.style['left'] = '0px'
        self.widgetsCollection.style['order'] = '0'
        self.subContainerLeft.append({
            'widgets_collection':
            self.widgetsCollection,
            'signal_manager':
            self.signalConnectionManager
        })
        self.subContainerLeft.add_class('RaisedFrame')

        self.centralContainer = gui.VBox(width='56%', height='100%')
        self.centralContainer.append(self.toolbar)

        self.subContainerRight = gui.Container(width='24%', height='100%')
        self.subContainerRight.style.update({
            'position': 'absolute',
            'right': '0px',
            'overflow-y': 'auto',
            'overflow-x': 'hidden'
        })
        self.subContainerRight.add_class('RaisedFrame')

        self.instancesWidget = editor_widgets.InstancesWidget(width='100%')
        self.instancesWidget.treeView.on_tree_item_selected.do(
            self.on_instances_widget_selection)

        self.subContainerRight.append({
            'instances_widget': self.instancesWidget,
            'attributes_editor': self.attributeEditor
        })

        self.subContainer.append([
            self.subContainerLeft, self.centralContainer,
            self.subContainerRight
        ])

        self.drag_helpers = [
            ResizeHelper(self, width=16, height=16),
            DragHelper(self, width=15, height=15),
            SvgDraggablePoint(self, 'cx', 'cy', [gui.SvgCircle]),
            SvgDraggableCircleResizeRadius(self, [gui.SvgCircle]),
            SvgDraggablePoint(self, 'x1', 'y1', [gui.SvgLine]),
            SvgDraggablePoint(self, 'x2', 'y2', [gui.SvgLine]),
            SvgDraggablePoint(self, 'x', 'y', [gui.SvgRectangle, gui.SvgText]),
            SvgDraggableRectangleResizePoint(self, [gui.SvgRectangle])
        ]
        for drag_helper in self.drag_helpers:
            drag_helper.stop_drag.do(self.on_drag_resize_end)

        self.menu_new_clicked(None)
        self.on_snap_grid_size_change(spin_grid_size,
                                      spin_grid_size.get_value())

        self.projectPathFilename = ''
        self.editCuttedWidget = None  # cut operation, contains the cutted tag

        # returning the root widget
        return self.mainContainer
Ejemplo n.º 25
0
    def build_keg_settings(self,
                           index=None,
                           channel=None,
                           chan_conf=None,
                           readonly=False,
                           edit=False):
        utils.debug_msg(self, "start")

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

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

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

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

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

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

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

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

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

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

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

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

        utils.debug_msg(self, "end")
        return keg_box
Ejemplo n.º 26
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)
Ejemplo n.º 27
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
Ejemplo n.º 28
0
    def main(self):
        self.verticalContainer = gui.Container(width=2000,
                                               margin='0px auto',
                                               style={
                                                   'display': 'block',
                                                   'overflow': 'hidden'
                                               })

        # chart container
        self.chartContainer = gui.Container(width=2000,
                                            margin='0px auto',
                                            style={
                                                'display': 'block',
                                                'overflow': 'hidden'
                                            })

        self.selectContainer = gui.Container(
            width='100%',
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })
        self.select_bt = gui.FileUploader('./',
                                          width=200,
                                          height=30,
                                          margin='10px')
        self.select_bt.ondata.do(self.on_data_select)

        self.index_lb = gui.Label('Index: ',
                                  width=30,
                                  height=30,
                                  margin='10px')
        self.index_input = gui.Input(input_type='number',
                                     default_value=0,
                                     width=40,
                                     height=15,
                                     margin='10px')
        self.index_input.onchange.do(self.on_index_change)
        self.expr = gui.TextInput(width=500, height=15, margin='10px')
        self.expr.set_text('Type in a expression')
        self.expr.onchange.do(self.on_expr_change)

        self.info_lb = gui.Label('Info: ',
                                 width=2000,
                                 height=30,
                                 margin='10px')

        self.selectContainer.append(
            [self.select_bt, self.index_lb, self.index_input, self.expr])

        self.chart = MultiLayerAttentionMap(abspath=self.res_path,
                                            load_path="/res:",
                                            width=2000,
                                            height=1000,
                                            margin='10px')
        self.chartContainer.append(self.selectContainer)
        self.chartContainer.append(self.info_lb)
        self.chartContainer.append(self.chart, "chart")

        self.next_bt = gui.Button('Next', width=200, height=30, margin='10px')
        self.next_bt.onclick.do(self.on_next_button_pressed)
        self.last_bt = gui.Button('Last', width=200, height=30, margin='10px')
        self.last_bt.onclick.do(self.on_last_button_pressed)

        self.verticalContainer.append(self.chartContainer)
        self.verticalContainer.append(self.next_bt)
        self.verticalContainer.append(self.last_bt)
        return self.verticalContainer
Ejemplo n.º 29
0
    def main(self):
        self.color_flipper = ['orange', 'white']

        self.centering_container = gui.Container(width=640,
                                                 height=360,
                                                 style={
                                                     'background-color':
                                                     'black',
                                                     "position": "absolute"
                                                 })

        #to make a left margin or 50px (because of google glasses curvature), I have to calculate a new height
        _w_margin = 40
        _h_margin = 0  # was _w_margin*360/640
        self.main_container = AsciiContainer(width=640 - _w_margin,
                                             height=360 - _h_margin,
                                             style={
                                                 'background-color':
                                                 'transparent',
                                                 'position':
                                                 'relative',
                                                 'margin-left':
                                                 gui.to_pix(_w_margin),
                                                 'margin-top':
                                                 gui.to_pix(_h_margin / 2)
                                             })

        self.main_container.set_from_asciiart("""
        | t0                                                                                                     |
        | left1        | pfd                                                                                     |
        | left1        | pfd                                                                                     |
        | left1        | pfd                                                                                     |
        | left2        | pfd                                                                                     |
        | left2        | pfd                                                                                     |
        | left2        | pfd                                                                                     |
        | left3        | pfd                                                                                     |
        | left3        | pfd                                                                                     |
        | left3        | pfd                                                                                     |
        | left4        | pfd                                                                                     |
        | left4        | pfd                                                                                     |
        | left4        | pfd                                                                                     |
        | s            | m                                   | t5                                 | t6           |
        | t1                                                                                                     |
        """,
                                              gap_horizontal=0,
                                              gap_vertical=0)

        w = "95%"
        h = 30
        self.slider_pitch = gui.SpinBox(0, -90.0, 90.0, 2.0, width=w, height=h)
        self.slider_orientation = gui.SpinBox(0,
                                              -180,
                                              180,
                                              2,
                                              width=w,
                                              height=h)
        self.slider_roll = gui.SpinBox(0, -180, 180, 2.0, width=w, height=h)
        self.slider_altitude = gui.SpinBox(0, 0, 9999, 1.0, width=w, height=h)
        self.slider_speed = gui.SpinBox(0, 0, 999, 1.0, width=w, height=h)
        """
        controls_container = gui.VBox()
        controls_container.append( gui.VBox(children=[gui.Label('pitch'), self.slider_pitch], width=300) )
        controls_container.append( gui.VBox(children=[gui.Label('orientation'), self.slider_orientation], width=300) )
        controls_container.append( gui.VBox(children=[gui.Label('roll'), self.slider_roll], width=300) )
        controls_container.append( gui.VBox(children=[gui.Label('altitude'), self.slider_altitude], width=300) )
        controls_container.append( gui.VBox(children=[gui.Label('speed'), self.slider_speed], width=300) )

        hbox0.append(controls_container)
        """
        h_divisions = 14.0
        self.pfd = PrimaryFlightDisplay(style={'position': 'relative'})
        _style = {
            'text-align': 'center',
            'color': self.standard_label_color,
            'outline': '1px solid black',
            'font-size': '16px'
        }
        self.t0 = gui.Label("T0", style=_style)
        self.t1 = gui.Label("WAITING FOR MAVLINK", style=_style)
        self.t5 = gui.Label("Voltage", style=_style)
        self.t6 = gui.Label("RPM", style=_style)
        self.s = gui.Label("GNSS", style=_style)
        self.m = gui.Label("MODE", style=_style)
        self.left1 = gui.Label("", style=_style)
        self.left2 = gui.Label("", style=_style)
        self.left3 = gui.Label("", style=_style)
        self.left4 = gui.Label("", style=_style)

        self.main_container.append(self.pfd, "pfd")
        self.main_container.append(self.t0, "t0")
        self.main_container.append(self.t1, "t1")
        self.main_container.append(self.t5, "t5")
        self.main_container.append(self.t6, "t6")
        self.main_container.append(self.s, "s")
        self.main_container.append(self.m, "m")
        self.main_container.append(self.left1, "left1")
        self.main_container.append(self.left2, "left2")
        self.main_container.append(self.left3, "left3")
        self.main_container.append(self.left4, "left4")

        # Here I start a parallel thread
        self.thread_alive_flag = True
        t = threading.Thread(target=self.my_threaded_function)
        t.start()

        self.centering_container.append(self.main_container)
        return self.centering_container
Ejemplo n.º 30
0
    def main(self):
        full = gui.Container(
            width=700,
            height=700,
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL)
        full.style['box-shadow'] = "none"

        screen = gui.Container(width=441, height=700)
        screen.style['box-shadow'] = "none"

        title_container = gui.Container(
            width='100%',
            height=50,
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL)
        black_icon = gui.Container(width=40, height=40)
        black_icon.style['background-image'] = "url('/my_res:black_stone.png')"
        black_icon.style['background-repeat'] = 'no-repeat'
        black_icon.style['background-size'] = '40px 40px'
        black_icon.style['background-color'] = 'transparent'
        black_icon.style['position'] = 'absolute'
        black_icon.style['top'] = "5px"
        black_icon.style['left'] = "5px"
        black_title = gui.Label("You")
        black_title.style['font-family'] = "Courier New"
        black_title.style['position'] = 'absolute'
        black_title.style['font-size'] = "32px"
        black_title.style['padding-top'] = "7px"
        black_title.style['padding-left'] = "50px"
        white_title = gui.Label("BetaGo")
        white_title.style['font-family'] = "Courier New"
        white_title.style['position'] = 'absolute'
        white_title.style['font-size'] = "32px"
        white_title.style['top'] = "7px"
        white_title.style['left'] = "275px"
        white_icon = gui.Container(width=50, height=50)
        white_icon.style['background-image'] = "url('/my_res:white_stone.png')"
        white_icon.style['background-repeat'] = 'no-repeat'
        white_icon.style['background-size'] = '40px 40px'
        white_icon.style['background-color'] = 'transparent'
        white_icon.style['position'] = 'absolute'
        white_icon.style['top'] = "5px"
        white_icon.style['left'] = "396px"
        self.black_score.style['font-family'] = 'Courier New'
        self.black_score.style['color'] = '#ff0066'
        self.black_score.style['font-style'] = 'italic'
        self.black_score.style['position'] = 'absolute'
        self.black_score.style['font-size'] = '22px'
        self.black_score.style['top'] = '13px'
        self.black_score.style['left'] = '128px'
        #self.black_score.style['visibility'] = 'Courier New'
        self.white_score.style['font-family'] = 'Courier New'
        self.white_score.style['color'] = '#ff0066'
        self.white_score.style['font-style'] = 'italic'
        self.white_score.style['position'] = 'absolute'
        self.white_score.style['font-size'] = '22px'
        self.white_score.style['top'] = '13px'
        self.white_score.style['left'] = '225px'
        title_container.append(black_icon)
        title_container.append(black_title)
        title_container.append(self.black_score)
        title_container.append(self.white_score)
        title_container.append(white_title)
        title_container.append(white_icon)

        container = gui.Container(width=441, height=441)
        container.style['background-image'] = "url('/my_res:board.png')"
        for i in range(19):
            for j in range(19):
                self.piece = gui.Container(width=22, height=22)
                self.piece.style['background-image'] = "none"
                self.piece.style['background-repeat'] = 'no-repeat'
                self.piece.style['background-size'] = '22px 22px'
                self.piece.style['background-color'] = 'transparent'
                self.piece.style['position'] = 'absolute'
                self.piece.style['left'] = str(2 + 23 * j) + 'px'
                self.piece.style['top'] = str(52 + 23 * i) + 'px'
                self.images.append(self.piece)
                container.append(self.piece)
        container.onmousedown.do(self.on_place_piece)
        pass_button = gui.Button('Pass')
        pass_button.onclick.do(self.pass_turn)
        new_game_button = gui.Button('New Game')
        new_game_button.onclick.do(self.new_game)

        self.list_view = gui.ListView(selectable=False, width=100, height=441)
        self.list_view.style['border'] = "1px groove gray"
        self.list_view.style['margin-top'] = '50px'
        self.list_view.style['margin-left'] = '25px'

        screen.append(title_container)
        screen.append(container)
        screen.append(pass_button)
        screen.append(new_game_button)

        full.append([screen, self.list_view])

        return full