def init__gui__(self):
        self.vbox_list_requests = G.VBox(width="100%")
        self.vbox_list_requests.append(G.Label("[Pending user requests]"))

        self.button_update = G.Button(u"🗘")
        self.button_update.onclick.do(self.a(self.on_update_all))

        self.vbox_publics = G.VBox(width="100%")
        self.vbox_publics.append(G.Label("[Publics]"))

        self.hbox_create_new = G.HBox(width="100%")
        self.edit_name = G.TextInput()
        self.button_add_new = G.Button("+")
        self.hbox_create_new.append([self.edit_name, self.button_add_new])
        self.button_add_new.onclick.do(self.a(self.on_add_new))

        self.vbox_publish_form = G.VBox(width="100%")
        self.select_channels = G.DropDown()
        self.edit_publish =G.TextInput()
        self.button_publish = G.Button("publish")
        self.button_publish.onclick.do(self.a(self.on_publish))
        self.vbox_publish_form.append([
            G.Label("[new publishment]"),
            self.select_channels,
            self.edit_publish,
            self.button_publish
        ])

        self.publics_controls = dict()
예제 #2
0
    def main(self, robot, appCallback):
        self.robot = robot

        root = gui.HBox(width = 1000, margin = "0px auto")
        root.style['align-items'] = 'stretch'

        leftSide = gui.VBox()
        leftSide.style['align-items'] = 'stretch'

        rightSide = gui.VBox()
        rightSide.style['align-items'] = 'flex-start'

        self.motorDataDict = { \
            "ampRow" : None,
            "tempRow" : None,
            "maxAmpRow" : None,
            "maxTempRow" : None,
            "amp" : [],
            "temp" : [],
            "maxAmp" : [],
            "maxTemp" : []
            }

        leftSide.append(self.initStats(robot))
        leftSide.append(self.initLedControl(robot))

        rightSide.append(self.initManual(robot))
        rightSide.append(self.initTest(robot))

        root.append(leftSide)
        root.append(rightSide)

        appCallback(self)
        return root
예제 #3
0
 def filtersMenu(self, widget):
     self.dialog = gui.GenericDialog(
         title='Filters Menu',
         message='Click Ok To Confirm Selection',
         width='300px')
     self.main_cont = gui.HBox(width=300)
     dates_cont = gui.VBox(width='50%')
     for date in dates:
         chb = gui.CheckBoxLabel(date, filt[date])
         chb.onchange.do(self.checkbox)
         dates_cont.append(chb)
     chb.onchange.do(self.checkbox)
     dates_cont.append(chb)
     self.main_cont.append(dates_cont)
     names_cont = gui.VBox(width='50%')
     for name in names:
         chb = gui.CheckBoxLabel(name, filt[name])
         chb.onchange.do(self.checkbox)
         names_cont.append(chb)
     self.main_cont.append(names_cont)
     names_cont.style['align-items'] = 'flex-start'
     dates_cont.style['align-items'] = 'flex-start'
     names_cont.style['justify-content'] = 'flex-start'
     dates_cont.style['justify-content'] = 'flex-start'
     self.dialog.add_field('main_cont', self.main_cont)
     self.dialog.confirm_dialog.do(self.diag_conf)
     self.dialog.show(self)
예제 #4
0
    def main(self):
        body = gui.VBox(width='100%', height='100%')
        main_container = gui.VBox(width=400,
                                  height=140,
                                  style={
                                      'align': 'center',
                                      'border': '5px #FFAC55 solid'
                                  })
        btn_container = gui.HBox(width=300, height=30)
        link_to_github = gui.Link(
            'https://github.com/npes87184/PyM3UGenerator', 'Fork me here')

        self.lbl = gui.Label('Please choose a folder')
        self.select_bt = gui.Button('Select folder', width=100, height=30)
        self.go_bt = gui.Button('Go', width=100, height=30)

        self.select_bt.onclick.do(self.on_select_btn_pressed)
        self.go_bt.onclick.do(self.on_go_btn_pressed)

        btn_container.append(self.select_bt)
        btn_container.append(self.go_bt)

        main_container.append(self.lbl)
        main_container.append(btn_container)
        main_container.append(link_to_github)
        body.append(main_container)

        return body
예제 #5
0
    def __init__(self, *args, **kwargs):
        super(AppSettingsWidget, self).__init__(*args, **kwargs)

        self.save_btn = SButton("Save settings", "fa-save", "btn btn-primary")
        self.save_btn.css_width = "300px"
        self.save_btn.css_margin = "5px auto"
        self.email_notifier_widget = EmailNotifierWidget(width="100%")
        self.camera_widget = CameraWidget(width="100%")

        cam_layout = gui.VBox()
        cam_layout.append(self.camera_widget)

        layout = gui.VBox(width="100%")
        layout.css_display = "block"
        layout.append(self.email_notifier_widget)
        layout.append(self.save_btn)

        self.append(HorizontalLine())
        self.append(cam_layout)
        self.append(layout)

        self.load_settings()
        # signals
        self.save_btn.onclick.do(self.save_settings)
        self.email_notifier_widget.on_send_message.do(
            self.send_test_notification)
        self.camera_widget.on_events_sequence_finished.do(
            self.maybe_send_notification)
예제 #6
0
    def main(self):
        wid = gui.VBox(width='100%', margin='0px auto')

        width = '300'  #'2048'
        height = '300'  #'1152'
        self.video = gui.Widget(width=300, height=300, _type='video')
        self.video.attributes['autoplay'] = 'true'
        self.video.style['overflow'] = 'hidden'
        self.video.attributes['width'] = width
        self.video.attributes['height'] = height

        self.canvas = gui.Widget(_type='canvas')
        self.canvas.style['display'] = 'none'
        self.canvas.attributes['width'] = width
        self.canvas.attributes['height'] = height

        self.imgGrabber = ImageGrabber(self, width, height)

        self.imgGrabber.new_image.do(self.on_new_image)
        self.imgGrabber.onnewvideodevice.do(self.new_video_device)
        getVideoInputsButton = gui.Button("Get cameras", margin='10px')
        getVideoInputsButton.onclick.do(self.on_get_video_inputs)
        captureButton = gui.Button("Start", margin='10px')
        captureButton.onclick.do(self.on_start_grab, None)
        snapshotButton = gui.Button("Grab Image", margin='10px')
        snapshotButton.onclick.do(self.snapshot)
        self.check_flash = gui.CheckBoxLabel('Flashlight',
                                             False,
                                             width=200,
                                             height=30,
                                             margin='10px')
        self.check_flash.set_on_change_listener(self.on_start_grab)

        self.label = gui.Label('Image capture')
        self.label.style['font-size'] = '18px'

        self.device_list = gui.DropDown(width=100)

        wid.append(self.label)
        wid.append(self.video)
        wid.append(self.canvas)
        wid.append(getVideoInputsButton)
        wid.append(self.device_list)
        wid.append(captureButton)
        wid.append(snapshotButton)
        wid.append(self.check_flash)

        self.opencvVideoWidget = OpencvVideoWidget(self, width=400, height=300)
        wid.append(
            gui.VBox(
                children=[gui.Label("opencv image"), self.opencvVideoWidget],
                style={'bolder': '1px dotted black'}))

        wid.add_child("javascript_image_grabber", self.imgGrabber)

        self.dialog = None

        # returning the root widget
        return wid
    def main(self, robot, appCallback):
        self.robot = robot

        self.fieldWidth = 520
        self.fieldHeight = 260
        self.fieldPixelsPerFoot = 10

        root = gui.HBox()
        root.style['align-items'] = 'stretch'

        leftSide = gui.VBox()
        leftSide.style['align-items'] = 'stretch'

        middle = gui.VBox()

        rightSide = gui.VBox()
        rightSide.style['align-items'] = 'stretch'

        self.motorDataDict = { \
            "ampRow" : None,
            "tempRow" : None,
            "maxAmpRow" : None,
            "maxTempRow" : None,
            "amp" : [],
            "temp" : [],
            "maxAmp" : [],
            "maxTemp" : []
            }

        leftSide.append(self.initStats(robot))
        leftSide.append(self.initLedControl(robot))
        leftSide.append(self.initScheduler(robot))
        leftSide.append(self.initBezier(robot))
        leftSide.append(self.initPathRecording(robot))

        middle.append(self.initCamera(robot))
        middle.append(self.initFieldMap(robot))
        middle.append(self.initFieldSwitcher(robot))

        rightSide.append(self.initManual(robot))
        self.autoSpeedGroup.highlight("medium")
        rightSide.append(self.initPidControlsBox(robot))
        rightSide.append(self.initVisionControl(robot))
        rightSide.append(self.initTest(robot))
        rightSide.append(self.initSubsystemsInfo(robot))

        root.append(leftSide)
        root.append(middle)
        root.append(rightSide)

        self.updateSchedulerFlag = False

        appCallback(self)
        return root
예제 #8
0
    def main(self):
        #custom additional html head tags
        my_html_head = """
            """

        #custom css
        my_css_head = """
            <link rel="stylesheet" href="" type="text/css">
            """

        #custom js
        my_js_head = """
            <script></script>
            """
        #appending elements to page header
        self.page.children['head'].add_child('myhtml', my_html_head)
        self.page.children['head'].add_child('mycss', my_css_head)
        self.page.children['head'].add_child('myjs', my_js_head)

        #setting up the application icon
        self.page.children['head'].set_icon_file("/res:icon.png")

        #eventually set up body attributes/style
        #self.page.children['body'].style['background-color'] = 'lightyellow'
        #eventually set up body event listeners
        #self.page.children['body'].onkeydown.do(self.onkeydown)

        #creating a container VBox type, vertical (you can use also HBox or Widget)
        main_container = gui.VBox(width=300, height=200, style={'margin':'0px auto'})

        # returning the root widget
        return main_container
예제 #9
0
    def main(self):
        container = gui.VBox(width=400,
                             height=240,
                             style={'margin': '0px auto'})
        self.lbl_01 = gui.Label('开源智慧农场监控页面', style={'font-size': '25px'})
        self.dd = gui.DropDown(['设备编号:' + x for x in project_list],
                               width=150,
                               style={'font-size': '12px'})
        self.lbl_1 = gui.Label('环境光照值:等待数据中')
        self.lbl_2 = gui.Label('土壤湿度值:等待数据中')
        self.lbl_9 = gui.Label(' ')

        self.bt = gui.Button('[ 浇水 ]')

        # 选择时执行
        self.dd.onchange.do(self.on_dropdown_onchange)

        # 按钮按下时执行
        self.bt.onclick.do(self.on_button_pressed)

        # 添加到网页上
        container.append(self.lbl_01)
        container.append(self.dd)
        container.append(self.lbl_1)
        container.append(self.lbl_2)
        container.append(self.bt)
        container.append(self.lbl_9)

        # 开启新的进程处理MQTT消息
        t = threading.Thread(target=self.showmqtt)
        t.start()

        # returning the root widget
        return container
예제 #10
0
    def main(self, name='world'):
        #margin 0px auto allows to center the app to the screen
        wid = gui.VBox(width=300, height=200, margin='0px auto')
        lbl = gui.Label('Hello %s!' % name, width='80%', height='50%')
        lbl.style['margin'] = 'auto'

        bt = gui.Button('Press me!', width=200, height=30)
        bt.style['margin'] = 'auto 50px'

        # setting the listener for the onclick event of the button
        self.npressed = 0

        bt.set_on_click_listener(self.on_button_pressed, lbl)
        bt.set_on_mousedown_listener(self.on_button_mousedown, 'data1', 2,
                                     'three')

        #this will never be called, can't register an event more than one time
        bt.set_on_mouseup_listener(self.on_button_mouseup, 'data1')

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

        # returning the root widget
        return wid
예제 #11
0
    def update(self, widget, widget_tree):
        """ for the selected widget are listed the relative signals
            for each signal there is a dropdown containing all the widgets
            the user will select the widget that have to listen a specific event
        """
        self.listeners_list = []
        self.build_widget_list_from_tree(widget_tree)

        self.label.set_text('Signal connections: ' +
                            widget.attributes['editor_varname'])
        del self.container
        self.container = gui.VBox(width='100%')
        self.container.style['overflow-y'] = 'scroll'
        self.append(self.container, 'container')
        ##for all the events of this widget
        #for registered_event_name in widget.eventManager.listeners.keys():
        #for all the function of this widget
        for (setOnEventListenerFuncname,
             setOnEventListenerFunc) in inspect.getmembers(
                 widget, predicate=inspect.ismethod):
            #if the member is decorated by decorate_set_on_listener and the function is referred to this event
            if hasattr(setOnEventListenerFunc, '_event_listener'):
                print(setOnEventListenerFuncname)
                #listener = widget.eventManager.listeners[registered_event_name]['instance']
                #listenerFunctionName = setOnEventListenerFunc._event_listener['eventName'] + "_" + widget.attributes['editor_varname']
                #self.container.append(gui.Label(setOnEventListenerFuncname),setOnEventListenerFuncname)#setOnEventListenerFunc._event_listener['eventName']))
                self.container.append(
                    SignalConnection(widget,
                                     self.listeners_list,
                                     setOnEventListenerFuncname,
                                     setOnEventListenerFunc,
                                     width='100%'))
예제 #12
0
    def main(self):
        wid = gui.HBox()
        wid.style['position'] = 'absolute'
        ctrl = gui.VBox(width=400)
        ctrl.style['justify-content'] = 'space-around'

        plotContainer = gui.Widget()

        plt = PlotlyWidget(data=self.data, id='plot')
        self.plt = plt
        plotContainer.append(plt)

        self.historyBox = LabelSpinBox(default_value=100, min=1, max=10000000,
                                       step=1, label='history')

        lbl = gui.Label('GUI')

        bt = gui.Button('Start', width=200, height=30)
        bt.style['margin'] = 'auto 50px'
        bt.style['background-color'] = 'green'

        self.started = False

        # setting the listener for the onclick event of the button
        bt.set_on_click_listener(self.on_button_pressed, ctrl)

        ctrl.append(lbl)
        ctrl.append(self.historyBox)
        ctrl.append(bt)

        # returning the root widget
        wid.append(ctrl)
        wid.append(plotContainer)

        return wid
예제 #13
0
  def main(self):
    
# --- open CSV, DictReader, for loop ---
    with open("translations.csv", "r") as words: 
      reader = csv.DictReader(words, delimiter = ",")
      for line in reader:
        english = line["English"].lower()
        spanish = line["Spanish"].lower()
        french = line["French"].lower()
        self.translations[english] = [spanish, french]

# --- GUI ---
    container = gui.VBox(width=500, height=300, style={"box-shadow":"none"})
    self.label = gui.Label("Type an English word to translate!", width=300, height=10, style={"font-size":"16px", "font-weight":"bold", "text-align":"center"})
    self.spanish = gui.Label("SPANISH: ", width=300, height=5, style={"font-size":"14px"})
    self.french = gui.Label("FRENCH: ", width=300, height=5, style={"font-size":"14px"})
    self.textinput = gui.TextInput(width=300, height=26, style={"padding-top":"10px", "padding-left":"10px"})
    self.error = gui.Label("", width=300, height=5, style={"font-style":"italic"})
    self.button = gui.Button("TRANSLATE", width=300, height=40, margin="10px", style={"background-color":"#F16059", "font-weight":"bold", "font-size":"16px", "box-shadow":"none"})

# --- GUI elements ---
    container.append(self.label)
    container.append(self.textinput)
    container.append(self.spanish)
    container.append(self.french)
    container.append(self.error)
    container.append(self.button)

# --- When you click on button, call the function on_button_pressed ---
    self.button.onclick.connect(self.on_button_pressed)
  
    return container
예제 #14
0
 def sectionBox(self):
     vbox = gui.VBox()
     vbox.style['border'] = '2px solid gray'
     vbox.style['border-radius'] = '0.5em'
     vbox.style['margin'] = '0.5em'
     vbox.style['padding'] = '0.2em'
     return vbox
예제 #15
0
    def main(self):
        self.stdoutbox = StdoutBox()

        self.title_bar = TitleBar()
        self.ipbox = IPBox()
        self.servicesbox = ServicesBox(self.stdoutbox)
        self.scriptbox = ScriptBox(
            self.stdoutbox, self.title_bar.refresh_all)

        self.title_bar.add_refresh_handler(self.ipbox.handle_refresh_ip)
        self.title_bar.add_refresh_handler(
            self.servicesbox.handle_refresh_services)

        self.title_bar.add_widget_to_middle(self.ipbox.build_ip_box())

        vbox_main = gui.VBox()
        vbox_main.append(self.title_bar.build_title_bar())
        vbox_main.append(self._build_middle_box())
        vbox_main.append(self.stdoutbox.build_stdout_box())

        for js_file in JS_FILES:
            # Add the javascript scripts to the end
            js = gui.Tag(_type='script')
            js.attributes["src"] = "/res/{}".format(js_file)
            vbox_main.add_child(js_file, js)

        return vbox_main
예제 #16
0
    def __add_child_widgets(self, current_account_name):
        self.layout_width = '90%'
        self.window = gui.VBox(width='100%')  # 全屏

        # administrator_textInput 控件: 输入账户名
        self.administrator_textInput = self.__get_administrator_textInput()
        self.administrator_hint_label = gui.Label("", width=self.layout_width, height='10%')

        # account_textInput 控件: 输入账户名
        self.account_textInput = self.__get_account_textInput()
        self.account_name_list_hint_label = gui.Label("", width=self.layout_width, height='10%')

        # time_label 控件: 当前时间
        self.time_label = self.__get_time_label()

        # table控件: 账户对应的持仓数据
        self.table = self.__get_table(account_name=current_account_name)

        return self.__window_add_subviews(
            self.administrator_textInput,
            self.administrator_hint_label,

            self.account_textInput,
            self.account_name_list_hint_label,

            self.time_label,
            self.table,
            window=self.window
        )
예제 #17
0
 def __init__(self, app: 'WebApp', sourcePart: 'WebSourcePart'):
     gui.HBox.__init__(self,
                       width=app.getWidth(),
                       height=app.getHeight(),
                       margin='0px auto')
     self._sourcePart = sourcePart
     self._app = app
     self._leftWidth = app.getWidth() - CONTROLS_WIDTH - 10
     self._structBox = self._createStructBox(
         self._leftWidth,
         app.getHeight() - CUR_TRACK_HEIGHT)
     self._controlsBox = self._createControlsBox(CONTROLS_WIDTH,
                                                 app.getHeight() - 10)
     self._trackBox = self._createTrackBox(self._leftWidth,
                                           CUR_TRACK_HEIGHT)
     leftBox = gui.VBox(width=self._leftWidth,
                        height=app.getHeight(),
                        margin='0px auto')
     leftBox.append(self._structBox, '1')
     leftBox.append(self._trackBox, '2')
     self.append(leftBox, '1')
     self.append(self._controlsBox, '2')
     # currently displayed node in selector
     self._nodeStruct = EMPTY_NODE_STRUCT
     # list of rendered child boxes
     self._childBoxes = []  # type: List[ChildBox]
     self.clear()
예제 #18
0
 def main(self):
     container = gui.VBox(width=250, height=800)
     
     for slider in self.servos:
         container.append(slider.container)
     # returning the root widget
     return container
예제 #19
0
    def main(self):

        vertContainer = gui.Widget(
            width='80%',
            layout_orientation=gui.Widget.LAYOUT_VERTICAL,
            margin='0px auto',
            style={
                'display': 'block',
                'overflow': 'auto',
                'background-color': '#BEBEBE'
            })
        vertContainer.style['text-align'] = 'center'
        vertContainer.style['align-items'] = 'center'
        vertContainer.style['justify-content'] = 'center'

        wid = gui.VBox(width=300, height=200, margin='0px auto')
        self.lbl1 = gui.Label('bottom text')
        self.lbl1.style['margin'] = 'auto'
        wid.append(self.lbl1)

        self.img = gui.Image('/res/wildcat.png', height=150, margin='0px auto')

        b1 = gui.Button('Add new tab', width=200, height=30)
        b2 = gui.Button('Show third tab', width=200, height=30)
        b3 = gui.Button('Show first tab', width=200, height=30)

        tb = gui.TabBox(width='100%')
        tb.add_tab([b1, b2], 'First', None)

        b1.set_on_click_listener(self.on_bt1_pressed, tb, 0)
        b2.set_on_click_listener(self.on_bt2_pressed, tb, 0)

        vertContainer.append(tb)

        return vertContainer
예제 #20
0
    def main(self, game):
        self.game = game
        self.last_known_turn = self.game.turn

        width, height = 800, 600  # Set board width and height

        svg = gui.Svg(width=width, height=height)
        svg.style['background-color'] = 'yellow'
        r = 35  # Set radius of slots
        ys = np.round(np.linspace(2 * r, height - 2 * r,
                                  self.game.dim[0])).astype(int)
        xs = np.round(np.linspace(2 * r, width - 2 * r,
                                  self.game.dim[1])).astype(int)
        self.grid = np.empty(self.game.dim, dtype='object')
        for rowi, y in enumerate(ys):
            for coli, x in enumerate(xs):
                circ = gui.SvgCircle(x=x, y=y, radius=r)  # Create slot
                circ.style['stroke'] = 'black'  # Set color of slot outline
                circ.style['fill'] = 'white'  # Set color of empty slot
                circ.onclick.do(self.on_click, pos=(rowi, coli))
                svg.append(circ)  # Add slot to GUI
                self.grid[rowi, coli] = circ

        self.text = gui.Label('')
        self.reset_button = gui.Button('Reset Game')
        self.reset_button.onclick.connect(self.reset)

        self.ended = False
        threading.Thread(target=self.update_thread).start()

        container = gui.VBox(width=width, height=height)
        container.append(svg)
        container.append(self.text)
        container.append(self.reset_button)
        return container
예제 #21
0
    def update(self, widget, widget_tree):
        """ for the selected widget are listed the relative signals
            for each signal there is a dropdown containing all the widgets
            the user will select the widget that have to listen a specific event
        """
        self.listeners_list = []
        self.build_widget_list_from_tree(widget_tree)

        self.label.set_text('Signal connections: ' +
                            widget.attributes['editor_varname'])
        #del self.container
        self.container = gui.VBox(width='100%', height='90%')
        self.container.style['justify-content'] = 'flex-start'
        self.container.style['overflow-y'] = 'scroll'
        self.append(self.container, 'container')
        ##for all the events of this widget
        #isclass instead of ismethod because event methods are replaced with ClassEventConnector
        for (setOnEventListenerFuncname,
             setOnEventListenerFunc) in inspect.getmembers(widget):
            #if the member is decorated by decorate_set_on_listener and the function is referred to this event
            if hasattr(setOnEventListenerFunc, '_event_info'):
                if setOnEventListenerFuncname == "onclick":
                    backup_editor_onclick = widget.onclick.callback
                    widget.onclick.callback = widget.backup_onclick_listener
                    setOnEventListenerFunc = widget.onclick
                self.container.append(
                    SignalConnection(widget,
                                     self.listeners_list,
                                     setOnEventListenerFuncname,
                                     setOnEventListenerFunc,
                                     width='100%'))
                if setOnEventListenerFuncname == "onclick":
                    widget.onclick.callback = backup_editor_onclick
예제 #22
0
    def main(self):
        container = gui.VBox(width=400, height=240,style={'margin':'0px auto'})
        self.lbl_01 = gui.Label('开源智慧农场监控页面',style={'font-size': '25px'})
        self.lbl_02 = gui.Label('(设备编号:' + projectid + ')',style={'font-size': '10px'})
        self.lbl_1 = gui.Label('环境光照值:等待数据中')
        self.lbl_2 = gui.Label('土壤湿度值:等待数据中')
        self.lbl_9 = gui.Label(' ')
        self.bt = gui.Button('[ 浇水 ]')

        # 按钮按下时执行
        self.bt.onclick.do(self.on_button_pressed)

        # 添加到网页上
        container.append(self.lbl_01)
        container.append(self.lbl_02)
        container.append(self.lbl_1)
        container.append(self.lbl_2)
        container.append(self.bt)
        container.append(self.lbl_9)
        
        # 开启新的进程处理MQTT消息
        t = threading.Thread(target=self.showmqtt)
        t.start()

        # returning the root widget
        return container
예제 #23
0
    def main(self):
        # We need to get dynamically the available voices
        self.voices_dict = {}
        # Default English_(Great_Britain) voice
        self.selected_voice_id = 78
        self.voices_dropdown = gui.DropDown.new_from_list(
            ["Loading voices list..."], width=200, height=20, margin='10px')
        self.container = gui.VBox(width=400)
        self.lbl = gui.Label("Text to say:")
        self.text_input = gui.TextInput(width=300)
        self.lbl_rate = gui.Label("Rate (speed) to say:")
        self.rate_slider = gui.Slider(1.0, min=0.1, max=5.0, step=0.1)
        self.lbl_pitch = gui.Label("Pitch of voice:")
        self.pitch_slider = gui.Slider(1.0, min=0.1, max=2.0, step=0.1)
        self.bt_say = gui.Button("Say")
        self.bt_say.onclick.do(self.on_say)

        self.container.append(self.lbl)
        self.container.append(self.text_input)
        self.container.append(self.lbl_rate)
        self.container.append(self.rate_slider)
        self.container.append(self.lbl_pitch)
        self.container.append(self.pitch_slider)
        self.container.append(self.bt_say)
        self.container.append(self.voices_dropdown, key=99999)

        # returning the root widget
        return self.container
예제 #24
0
    def main(self):

        for line in f:
            self.paragraph = gui.Label(line)
            break

        container = gui.VBox(width=1000, height=300)
        self.lbl = gui.Label('Say the following:')
        self.bt1 = gui.Button('Press to speak')
        self.bt2 = gui.Button('Press to stop')
        self.res = gui.Label('Look')
        self.incorrectNum = gui.Label("Incorrect: ")

        # setting the listener for the onclick event of the button
        self.bt1.onclick.do(self.on_button_pressed1)
        self.bt2.onclick.do(self.on_button_pressed2)

        # appending a widget to another, the first argument is a string key
        container.append(self.lbl)
        container.append(self.paragraph)
        container.append(self.bt1)
        container.append(self.bt2)
        container.append(self.res)
        container.append(self.incorrectNum)

        # returning the root widget
        return container
예제 #25
0
    def main(self, name='world'):
        self.wid = gui.VBox(margin='0px auto')

        self.svgplot = SvgPlot(600, 600)
        self.svgplot.style['margin'] = '10px'
        self.plotData1 = SvgComposedPoly(0, 0, 60, 2.0, 'rgba(255,0,0,0.8)')
        self.plotData2 = SvgComposedPoly(0, 0, 60, 1.0, 'green')
        self.plotData3 = SvgComposedPoly(0, 0, 30, 3.0, 'orange')
        self.svgplot.append_poly(
            [self.plotData1, self.plotData2, self.plotData3])

        scale_factor_x = 1.0
        scale_factor_y = 200.0
        self.plotData1.scale(scale_factor_x, scale_factor_y)
        self.plotData2.scale(scale_factor_x, scale_factor_y)
        self.plotData3.scale(scale_factor_x, scale_factor_y)

        self.wid.append(self.svgplot)

        self.stop_flag = False

        self.count = 0
        self.add_data()

        bt = gui.Button("Zoom - ")
        bt.onclick.do(self.zoom_out)
        self.wid.append(bt)

        # returning the root widget
        return self.wid
예제 #26
0
    def main(self):
        # creating two "pages" widgets to be shown alternatively
        lbl = gui.Label("Page 2. Press the button to change the page.",
                        style={'font-size': '20px'})
        bt2 = gui.Button("change page")
        page2 = gui.HBox(children=[lbl, bt2],
                         style={
                             'margin': '0px auto',
                             'background-color': 'lightgray'
                         })

        lbl = gui.Label("Page 1. Press the button to change the page.",
                        style={'font-size': '20px'})
        bt1 = gui.Button("change page")
        page1 = gui.VBox(children=[lbl, bt1],
                         style={
                             'width': '300px',
                             'height': '200px',
                             'margin': '0px auto',
                             'background-color': 'white'
                         })

        bt1.onclick.do(self.set_different_root_widget, page2)
        bt2.onclick.do(self.set_different_root_widget, page1)

        # returning the root widget
        return page1
예제 #27
0
 def __init__(self, **kwargs):
     super(SignalConnectionManager, self).__init__(**kwargs)
     self.label = gui.Label('Signal connections')
     self.append(self.label)
     self.container = gui.VBox(width='100%')
     self.container.style['overflow-y'] = 'scroll'
     self.listeners_list = []
예제 #28
0
파일: mvcish.py 프로젝트: mohsenuss91/remi
    def main(self):
        wid = gui.VBox(width=300, height=300)

        self._items = ("/test/1", "/test/7")

        self.dd = gui.DropDown.new_from_list(self._items,
                                             width='80%',
                                             height=40)
        self.list = gui.ListView.new_from_list(self._items,
                                               width='80%',
                                               height='50%')
        self.ent = gui.TextInput(width=200, height=30, hint='enter words')
        self.bt = gui.Button('Update Models', width=200, height=30)
        self.bt.style['margin'] = 'auto 50px'

        self.bt.set_on_click_listener(self.on_button_pressed)

        # appending a widget to another, the first argument is a string key
        wid.append(self.dd)
        wid.append(self.list)
        wid.append(self.ent)
        wid.append(self.bt)

        # returning the root widget
        return wid
예제 #29
0
    def main(self):
        container = gui.VBox(width = 600, height = 800)
        self.lbl = gui.Label('Hello world!')
        self.btFindStar = gui.Button('FIND_STAR')
        self.btCalibrate = gui.Button('CALIBRATE')
        self.btStartGuide = gui.Button('START GUIDE')
        self.btStopGuide = gui.Button('STOP GUIDE')
        self.gain = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px')
        self.gain.set_on_change_listener(self.slider_changed)
	self.image_widget = PILImageViewverWidget(width=200, height=200)

        # setting the listener for the onclick event of the button
        self.btFindStar.set_on_click_listener(self.on_button_pressed)
        self.btCalibrate.set_on_click_listener(self.on_button_pressed)
        self.btStartGuide.set_on_click_listener(self.on_button_pressed)
        self.btStartGuide.set_on_click_listener(self.StartGuide)
        self.btStopGuide.set_on_click_listener(self.StopGuide)

        # appending a widget to another, the first argument is a string key
        container.append(self.image_widget)
        container.append(self.lbl)
        container.append(self.btFindStar)
        container.append(self.btCalibrate)
        container.append(self.btStartGuide)
        container.append(self.btStopGuide)
        container.append(self.gain)

	self.image()
	self.image_widget.load('/home/pi/linguider.png')
        # returning the root widget
        return container
예제 #30
0
    def main(self):
        while True:
           print("Inside")
           global bpm, emg, accelX, accelY, accelZ, tempF, hr, spo2, leftButton, rightButton, data
           container = gui.VBox(width=500, height=200)
           self.lbl = gui.Label('Hello world!')
           self.emgLabel = gui.Label("EMG: ")
           self.tempLabel = gui.Label("Temp: ")
           self.hrLabel = gui.Label("HR: ")
           self.spo2Label = gui.Label("SpO2: ")
           self.xLabel = gui.Label("Accel-X: ")
           self.yLabel = gui.Label("Accel-Y: ")
           self.zLabel = gui.Label("Accel-Z: ")
           self.bt = gui.Button('Press me!')

           self.update = True
           # setting the listener for the onclick event of the button
           self.bt.onclick.do(self.on_button_pressed)

           # appending a widget to another, the first argument is a string key
           container.append(self.lbl)
           container.append(self.emgLabel)
           container.append(self.tempLabel)
           container.append(self.hrLabel)
           container.append(self.spo2Label)
           container.append(self.xLabel)
           container.append(self.yLabel)
           container.append(self.zLabel)
           container.append(self.bt)

           # returning the root widget
           return container