예제 #1
0
    def init(self):
        self.main_container = flx.VSplit(
            style='font-family: "Helvetica Neue";')
        with self.main_container:
            with flx.VSplit(flex=2):
                self.image = flx.Widget(flex=4, style='background: black;')
                self.title_w = flx.Widget(flex=1)
                with self.title_w:
                    self.title = ui.Label(wrap=True)
                self.overview_w = flx.Widget(flex=1, style='height: 10vh;')
                with self.overview_w:
                    self.overview = ui.Label(wrap=True)
            with flx.HBox(flex=1):
                # self.h_button = flx.Button(text='Horrible', flex=1)
                self.m_button = flx.Button(text='Meh', flex=1)
                self.n_button = flx.Button(text='Neutral', flex=1)
                self.g_button = flx.Button(text='Yeah!', flex=1)
                # self.a_button = flx.Button(text='Amazing', flex=1)
            with flx.HBox(flex=0):
                self.slider = ui.Slider(text='Exploration/Exploitation',
                                        flex=3,
                                        min=0,
                                        max=1,
                                        step=0.01,
                                        value=sliderValue)
                # self.label = ui.Label(flex=1)
                # self.label = flx.Label(flex=1)

            # class JS:
            #     @react.connect('slider.value')
            #     def _change_label(self, value):
            #         self.label.text('x'.repeat(value))
        self.set_movie()
예제 #2
0
 def init(self):
     with flx.FormLayout() as self.form:
         self.update_button = flx.Button(text='Update JAR', flex=1)
         flx.Widget(flex=1)
         self.name = flx.LineEdit(title='Display Name')
         self.rotation = flx.ComboBox(title='Rotation:', options=rotations, selected_index=0)
         self.new_screen = flx.Button(text='Create New Display', flex=1)
예제 #3
0
파일: rosmon.py 프로젝트: svbhat/flexxros
    def init(self, topic):

        self.server_name = topic.split("/")[1]
        self.service_name = "/" + self.server_name + "/start_stop"

        self.nodes = {}
        self.subscribe(topic, "rosmon_msgs/State", self.callback)
        self.list_container = flx.VBox(flex=1)
        with self.list_container:
            with flx.HBox(flex=1):
                self.expand = flx.Button(flex=0, text=">")
                self.label = flx.Label(flex=0, text=self.server_name + ":")
                self.launch_state = flx.Label(flex=0,
                                              text="IDLE",
                                              style='color: #F00;')
                #self.expand = flx.Button(text="Expand")
                flx.Widget(flex=1)
                self.start_stop = flx.Button(flex=0, text="Stop")
            self.base_layout = flx.VBox(flex=1, style='border:1px solid #777;')
            with self.base_layout:
                with flx.HFix():
                    flx.Label(text="Name")
                    flx.Label(text="State")
                    flx.Label(text="CPU")
                    flx.Label(text="Memory")
                    flx.Label(text="Restarts")
                    flx.Label(text="Action")
        self.base_layout.set_parent(None)
예제 #4
0
    def init(self):
        super().init()

        with flx.HBox():
            self.but1 = flx.Button(text='reset')
            self.but2 = flx.Button(text='increase')
            self.label = flx.Label(text='', flex=1)  # take all remaining space
예제 #5
0
 def init(self):
     flx.Widget(flex=1)
     with flx.VBox():
         with flx.HBox():
             self.b1 = flx.Button(text='Hello', css_class="border-red", flex=1)
             self.b2 = flx.Button(text='World', css_class="border-green", flex=1)
     flx.Widget(flex=1)
예제 #6
0
    def init(self):
        super().init()

        with flx.VBox():

            flx.Label(text='You should see 5 pairs of buttons')

            with flx.HFix():  # Use minsize in CSS of button widget
                with flx.GroupWidget(title='asdas'):
                    with flx.HFix():
                        flx.Button(text='foo')
                        flx.Button(text='bar')

            with flx.HFix(minsize=50):  # Set minsize prop on container
                flx.Button(text='foo')
                flx.Button(text='bar')

            with flx.HFix():  # Set minsize prop on widget
                flx.Button(text='foo', minsize=50)
                flx.Button(text='bar')

            with flx.HFix():  # Old school setting of style
                flx.Button(text='foo', style='min-height:50px;')
                flx.Button(text='bar', )

            with flx.Widget():  # Singleton widgets (e.g. custom classes)
                with flx.HFix():
                    flx.Button(text='foo')
                    flx.Button(text='bar')

            flx.Widget(flex=1, style='background:#f99;')  # spacer
예제 #7
0
 def init(self, additional_style="width: 100%; height: 100%;"):
     with flx.VFix(flex=1, style=additional_style) as self.frame:
         with flx.VFix(flex=1) as self.page:
             self.custom = flx.VFix(flex=1, style="width: 100%; height: 100%; border: 5px solid green;")
             with flx.HFix(flex=1):
                 self.but = flx.Button(text="Replace by PyWidget2")
                 self.but_close = flx.Button(text="Close")
             self.input = flx.LineEdit(text="input")
예제 #8
0
 def init(self, descs, cls_detail=PanelProtocolDetail):
     super().init(descs)
     self.cls_detail = cls_detail
     with flx.HFix():
         self.lbl_title = flx.Label(flex=4)
         self._cont = flx.HFix(flex=42)
         self.btn_detail = flx.Button(text="...", flex=2, disabled = not cls_detail)
         self.btn_remove = flx.Button(text="-", flex=1)
예제 #9
0
 def init(self):
     self.cfg_name = '.scapy-ui'
     self.lst_names = []
     with flx.VBox():
         self.lst_config = flx.GroupWidget(title="Recent:",
                                           flex=1,
                                           css_class="list")
         self.btn_load = flx.Button(text='Load Pcap...')
         self.btn_sniff = flx.Button(text='S(n)iff...')
     self.load_names()
예제 #10
0
파일: stack.py 프로젝트: levinbgu/flexx
 def init(self):
     with flx.VBox():
         with flx.HBox():
             self.buta = flx.Button(text='red')
             self.butb = flx.Button(text='green')
             self.butc = flx.Button(text='blue')
             flx.Widget(flex=1)  # space filler
         with flx.StackLayout(flex=1) as self.stack:
             self.buta.w = flx.Widget(style='background:#a00;')
             self.butb.w = flx.Widget(style='background:#0a0;')
             self.butc.w = flx.Widget(style='background:#00a;')
예제 #11
0
 def init(self):
     with flx.VBox(flex=0):
         with flx.VBox(flex=0):
             src = str(que[0])
             self.img = flx.ImageWidget(flex=0, stretch=False, source=src)
             self.img.set_minsize(500, 500)
             self.img.set_maxsize(500, 500)
         with flx.HBox(flex=1):
             self.b1 = flx.Button(text="Yes")
             self.void = flx.Label()
             self.b2 = flx.Button(text="No")
             self.b1.set_maxsize(40, 40)
             self.b2.set_maxsize(40, 40)
             self.void.set_maxsize(420, 40)
예제 #12
0
 def init(self):
     with flx.VBox(flex=0):
         with flx.VBox(flex=0):
             src = "https://www.designyourway.net/blog/wp-content/uploads/2019/05/iPad-Pro-wallpaper-54-700x700.jpg"
             self.img = flx.ImageWidget(flex=0, stretch=False, source=src)
             self.img.set_minsize(500, 500)
             self.img.set_maxsize(500, 500)
         with flx.HBox(flex=1):
             self.b1 = flx.Button(text="Yes")
             self.void = flx.Label()
             self.b2 = flx.Button(text="No")
             self.b1.set_maxsize(40, 40)
             self.b2.set_maxsize(40, 40)
             self.void.set_maxsize(420, 40)
예제 #13
0
    def init(self):

        with flx.HFix():
            with flx.FormLayout() as self.form:
                self.b1 = flx.LineEdit(title='Name:', text='Hola')
                self.b2 = flx.LineEdit(title='Age:', text='Hello world')
                self.b3 = flx.LineEdit(title='Favorite color:', text='Foo bar')
                flx.Button(text='Submit')
            with flx.FormLayout() as self.form:
                self.b4 = flx.LineEdit(title='Name:', text='Hola')
                self.b5 = flx.LineEdit(title='Age:', text='Hello world')
                self.b6 = flx.LineEdit(title='Favorite color:', text='Foo bar')
                flx.Button(text='Submit')
                flx.Widget(flex=1)  # Add a spacer
예제 #14
0
 def init(self, v=0):
     self.pkt = None
     with ui.VBox():
         with ui.HBox():
             self.lbl_repr = flx.LineEdit(flex=1, css_class="pkt_dump", disabled=1)
             self.btn_toggle = flx.Button(text="-")
             self.btn_save = flx.Button(text='save pcap')
         with ui.VBox(flex=1) as self._cont:
             with ui.VSplit(flex=1, parent=None) as self.splt_v:
                 pass
             with ui.HSplit(flex=1) as self.splt_h:
                 self.txt_show = ui.MultiLineEdit(css_class="pkt_dump", flex=4)
                 self.txt_hex = ui.MultiLineEdit(css_class="pkt_dump", flex=6)
         self.splt = self.splt_h
         self.toggle_layout(v)    
예제 #15
0
 def init(self):
     with flx.VFix(flex=1) as self.frame_layout:
         self.dynamic = flx.DynamicWidgetContainer(
             style="width: 100%; height: 100%; border: 5px solid black;",
             flex=1)
         self.but = flx.Button(
             text="Instanciate a PyWidget1 in the dynamic container")
예제 #16
0
 def init(self):
     self.box = []
     with flx.VBox(
             flex=1,
             style='border:2px solid gray;border-radius: 5px;text-align:left'
     ):
         with flx.HFix(flex=1, style='text-align:left'):
             flx.Label(text='Testpmd args:')
             self.cb_as = flx.CheckBox(text="auto-start")
             self.cb_crc = flx.CheckBox(text="disable-crc-strip")
             self.cb_fia = flx.CheckBox(text="flow-isolate-all")
         with flx.HBox(flex=1):
             ui.Label(text='--rxq:', flex=0)
             self.rxq = ui.LineEdit(text='1', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--rxd:', flex=0)
             self.rxd = ui.LineEdit(text='64', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--txq:', flex=0)
             self.txq = ui.LineEdit(text='1', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--txd:', flex=0)
             self.txd = ui.LineEdit(text='64', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--hairpin:', flex=0)
             self.hairpin = ui.LineEdit(text='0', flex=1)
         with flx.HFix(flex=1, style=' text-align:left'):
             self.cmdline = ui.Label(text='testpmd cmdline:', flex=10)
             self.start = flx.Button(text='start', flex=1)
예제 #17
0
 def init(self):
     with flx.GroupWidget(title='A silly panel'):
         with flx.VBox():
             self.progress = flx.ProgressBar(min=0,
                                             max=9,
                                             text='Clicked {value} times')
             self.but = flx.Button(text='click me')
예제 #18
0
 def init(self, additional_style="width: 100%; height: 100%;"):
     with flx.VFix(flex=1, style=additional_style) as self.frame:
         with flx.VFix(flex=1) as self.page:
             self.custom = flx.VFix(
                 flex=1,
                 style="width: 100%; height: 100%; border: 5px solid blue;")
             self.but = flx.Button(text="Swap back to a PyWidget1")
예제 #19
0
 def init(self, parameters, mpane, module_type, mod_parent):
     flx.Label(text="Parameters for this module:", style="color: #fff;")
     self.params = flx.LineEdit(text=parameters, style="width: 500px;")
     self.okbtn = flx.Button(text="OK")
     self.mpane = mpane
     self.module_type = module_type
     self.mod_parent = mod_parent
예제 #20
0
 def init(self):
     with flx.VBox():
         self.b1 = flx.Button(text='apple')
         self.b2 = flx.Button(text='banana')
         self.b3 = flx.Button(text='pear')
         self.buttonlabel = flx.Label(text='...')
     with flx.VBox():
         self.r1 = flx.RadioButton(text='apple')
         self.r2 = flx.RadioButton(text='banana')
         self.r3 = flx.RadioButton(text='pear')
         self.radiolabel = flx.Label(text='...')
     with flx.VBox():
         self.c1 = flx.ToggleButton(text='apple')
         self.c2 = flx.ToggleButton(text='banana')
         self.c3 = flx.ToggleButton(text='pear')
         self.checklabel = flx.Label(text='...')
예제 #21
0
    def init(self):
        super().init()
        #        self._mutate_sercon(SerialConnection('/dev/ttyACM1'))
        self.sercon = SerialConnection('/dev/sensor_0')
        #        self._mutate_serconChiller(SerialConnectionChiller('/dev/ttyUSB0'))
        self.serconChiller = SerialConnectionChiller('/dev/ttyUSB0')
        #        self._mutate_serconSensirion(SerialConnectionSensirion('/dev/ttyACM0'))
        self.serconSensirion = SerialConnectionSensirion('/dev/sensor_1') 
        #        self._mutate_ledcon(LedPulser())
        self.ledcon = LedPulser() 
        self.hvcon = SerialConnectionHV('/dev/ttyUSB4')

        self.t0 = datetime.now()
        #Always start in inhbit mode
        reply=self.sercon.sendCommand('i')
        if (reply!='INH'):
            print('Please check serial connection')

        reply=self.sercon.sendCommand('0')
        if (reply!='V0'):
            print('Please check serial connection')

        ret=self.ledcon.ledSwitch(0)
        if (ret!=0):
            print('Please check led pulser connection')

#        with flx.HBox(flex=0, spacing=10):

        with flx.PinboardLayout():
            self.tempText = flx.Label(text='T: XX.XX H: YY.YY',style='left:10px; top:120px; width:300px;height:20px;')
            self.sensirionText = flx.Label(text='T_EXT:XXX.XX H_EXT:YYY.YY DEW_EXT:ZZZ.ZZ',style='left:10px; top:140px; width:400px;height:20px;')
            self.hvText = flx.Label(text='VSET:XXX.XX VMON:XXX.XX',style='left:10px; top:180px; width:300px;height:20px;')
            self.chillerText = flx.Label(text='CHILLER TBATH:XXX.XX TSET:YYY.YY PUMP:ZZ',style='left:10px; top:160px; width:400px;height:20px;')
            self.but1 = flx.Button(text='Led Pulser',css_class="border-black",style='left:10px; top:10px; width:180px;height:100px;')
            self.but2 = flx.Button(text='HV',css_class="border-black",style='left:200px; top:10px; width:150px;height:100px;')
            self.but3 = flx.Button(text='VSEL',css_class="border-black",style='left:360px; top:10px; width:100px;height:100px;')
            self.chillerStatus = flx.Button(text='COOLING OK',css_class="border-black",style='left:470px; top:10px; width:250px;height:100px;')
#            self.label = flx.Label(text='', flex=1)  # take all remaining space

        self.refreshTemperature()
        self.refreshChiller()
        self.refreshSensirion()
        self.refreshHV()
#upload to things speak (every 60s)
        self.refreshThingSpeak()

        self.initialised=1
예제 #22
0
 def init(self, retico_widget):
     self.retico_widget = retico_widget
     self.l_title = flx.Label(text="", css_class="title-label")
     self.close_button = flx.Button(text="X", css_class="close-button")
     with flx.VBox(
             style=
             "cursor: default; padding-bottom: 30px; padding-left: 20px; padding-right:20px; padding-top: 30px;"
     ) as self.content_box:
         self.content_box.set_padding("20px")
     self.out_button_l = flx.Button(text="◀",
                                    css_class="out-button left-button")
     self.out_button_r = flx.Button(text="▶",
                                    css_class="out-button right-button")
     self.in_button_l = flx.Button(text="▶",
                                   css_class="in-button left-button")
     self.in_button_r = flx.Button(text="◀",
                                   css_class="in-button right-button")
     self.enable_button = flx.Button(text="enabled",
                                     css_class="enable-button")
     self.trigger_edit = flx.LineEdit(self.content_box)
     self.trigger_button = flx.Button(parent=self.content_box,
                                      text="Trigger")
     self.trigger_edit.set_parent(None)
     self.trigger_button.set_parent(None)
     self.trigger_button.set_disabled(True)
     self.set_active(True)
     self.set_position()
예제 #23
0
    def init(self):
        report = re.Report()
        report.init(
            123,
            42,
            "pepe",
            28,
            "juan",
            2019,
            fileDescriptor=
            "<fo:block ><fo:image ></fo:image><fo:block >Value of Variable: $Variable1$</fo:block></fo:block><fo:block ></fo:block>"
        )

        with flx.VBox():
            with flx.HBox():
                with flx.HBox():
                    self.new = flx.Button(text='Create New Template', flex=0)
                    self.save = flx.Button(text='Save Template', flex=1)
                    self.load = flx.Button(text='Load Template', flex=2)
                    self.download = flx.Button(text='Get_XML_File', flex=3)
                with flx.HBox():
                    self.region = flx.Button(text='Add Region Container',
                                             flex=4)
                    self.text = flx.Button(text='Add Text Container', flex=5)
                    self.image = flx.Button(text='Add Image Container', flex=6)
        self.XML = flx.Label(text="No XML Available Yet", flex=7)
예제 #24
0
    def init(self):

        with flx.VBox():
            flx.Label(html='<h3>Server monitor</h3>')
            if flx.current_server().serving[0] == 'localhost':
                # Don't do this for a public server
                self.button = flx.Button(text='Do some work')
                self.button.reaction(self._do_work, 'pointer_down')
            self.view = MonitorView(flex=1)
예제 #25
0
파일: example.py 프로젝트: svbhat/flexxros
    def init(self):
        with flx.FormLayout(flex=1, maxsize=400):
            self.type_message = flx.LineEdit(title="Message to send:", text="")
            self.send_message = flx.Button(text="Publish message")
            self.receive_message = flx.Label(title="Received message:",
                                             text="Waiting for message...")

        self.announce_publish("/test_topic", "std_msgs/String")
        self.subscribe("/test_topic", "std_msgs/String", self.callback)
예제 #26
0
파일: leaflet.py 프로젝트: www3838438/flexx
 def init(self):
     with flx.HBox():
         self.leaflet = LeafletWidget(
             flex=1,
             center=(52, 4.1),
             zoom=12,
             show_scale=lambda: self.cbs.checked,
             show_layers=lambda: self.cbl.checked,
         )
         with flx.VBox():
             self.btna = flx.Button(text='Add SeaMap')
             self.btnr = flx.Button(text='Remove SeaMap')
             self.cbs = flx.CheckBox(text='Show scale')
             self.cbl = flx.CheckBox(text='Show layers')
             self.list = flx.VBox()
             flx.Widget(flex=1)
     
     self.leaflet.add_layer('http://a.tile.openstreetmap.org/', 'OpenStreetMap')
예제 #27
0
 def init(self):
     with flx.VBox(flex=1):
         self.file_browser = flx.FileBrowserWidget(flex=1)
         with flx.HBox():
             flx.LineEdit(text=lambda: self.file_browser.path,
                          flex=8,
                          disabled=1)
             flx.Label(text=" / ")
             self.txt_file = flx.LineEdit(flex=3)
             self.btn_file = flx.Button(flex=1)
예제 #28
0
파일: gui.py 프로젝트: caph1993/caph-slides
 def init(self):
     global window
     super().init()
     self.buttons = {}
     with flx.VBox():
         self.buttons.source = flx.Button(css_class='mono')
         with SHBox(flex=1) as h:
             with SContent():
                 self.editor = CodeEditor(flex=1)
             with SContent():
                 with flx.VBox(css_class='small-padding'):
                     self.buttons.open_html = flx.Button(text='View html')
                     self.buttons.open_pdf = flx.Button(
                         text='Printable html')
                     with flx.VBox(flex=1):
                         self.preview = HTMLPreview()
             h.split_children()
     self._init_ready()
     return
예제 #29
0
 def init(self):
     self.f*g = F*g()
     self.cnt = 0
     self.flag = 0
     self.ql = []
     self.num = 0
     # self.apply_style('overflow-y: scroll;')  # enable scrolling
     with flx.VBox() as self.vb1:
         with flx.HSplit() as self.hb1:
             self.lb1 = flx.Label(text='题目数量:')
             self.le1 = flx.LineEdit(placeholder_text='输入题目数量,不要超过1000')
             self.b1 = flx.Button(text='产生题目')
             self.b2 = flx.Button(text='导出题目')
             self.b3 = flx.Button(text='开始答题')
         with flx.HSplit() as self.hb2:
             self.lb2 = flx.Label(text='输入答案: ')
             self.le2 = flx.LineEdit(placeholder_text='输入你的答案')
             self.lb3 = flx.Label(text='提示框:')
             self.le3 = flx.LineEdit()
         self.le4 = flx.Label()
예제 #30
0
 def init(self):
     self.json = None
     with flx.FormLayout() as self.form:
         self.name = flx.ComboBox(title='Display Name:', options=screens)
         self.rotation = flx.ComboBox(title='Rotation:', options=rotations)
         flx.Widget(flex=1)
         with flx.TreeWidget(flex=2, title='Defaults:', max_selected = 1) as self.default_box:
             self.defaults = []
             for i in range(max_scheduled):
                 self.defaults[i] = flx.TreeItem(title=str(i), checked=False)
                 self.defaults[i].set_visible(False)
         with flx.TreeWidget(flex=2, title='Events:', max_selected = 1) as self.event_box:
             self.events = []
             for i in range(max_scheduled):
                 self.events[i] = flx.TreeItem(title=str(i), checked=False)
                 self.events[i].set_visible(False)
         self.delete = flx.Button(text='Delete Selected Entries')
         self.revert = flx.Button(text='Revert Changes')
         self.upload = flx.Button(text='Save and Upload')
         flx.Widget(flex=5)