Exemple #1
0
  def _create_widgets(self):
    self._main = fbgui.Panel("main",
                             settings=fbgui.Settings({
                             }),toplevel=True)
    fbgui.Image("background",img=self._imgpath,parent=self._main)
    self._vbox = fbgui.VBox("vbox",
                            settings=fbgui.Settings({
                             'align': (fbgui.TOP,fbgui.LEFT),
                             'width': 1.0,
                             'height': 1.0,
                             'padding': 10
                            }),parent=self._main)
    self._header = fbgui.Panel("header",
                            settings=fbgui.Settings({
                             'width': 1.0,
                             'padding': 10
                            }),parent=self._vbox)
    self._dtlabel = fbgui.Label("datetime","Do 21.11.2019 16:41",
                                settings=fbgui.Settings({
                                  'align': fbgui.LEFT}),
                                parent=self._header)
    self._templabel = fbgui.Label("temp","22.5°C",
                                settings=fbgui.Settings({
                                  'align': fbgui.RIGHT}),
                                parent=self._header)
    self._wdata   = fbgui.Text("wdata","""Wetterbericht für: München

               leichter Nebel
  _ - _ - _ -  3..4 °C        
   _ - _ - _   ← 6 km/h       
  _ - _ - _ -  4 km           
               0.1 mm""",
                                parent=self._vbox)
Exemple #2
0
  def _get_widgets(self):
    """ create widget-tree """
    
    main = fbgui.VBox("main",
                      settings=fbgui.Settings({
                        'margins': 20,
                        'padding': 10
                        }),
                      toplevel=True)
    # add date-box
    self._add_date_box(main)

    # add info-box
    # since we set weight only here, the infobx will take all available space
    self._info_box = fbgui.List("info_box",None,
                                 settings=fbgui.Settings({
                                  'bg_color': fbgui.Color.SILVER,
                                  'font_name': "FreeMonoBold.ttf",
                                  'radius': 0.1,
                                  'margins': 20,
                                  'width': 1.0,
                                  'weight': 1
                                  }),parent=main)
    # add button-box
    self._add_button_box(main)

    return main
Exemple #3
0
 def _create_widgets(self):
   self._main = fbgui.VBox("main",
                     settings=fbgui.Settings({
                       'padding': 5
                     }),toplevel=True)
   fbgui.VGap("gap1",
              settings=fbgui.Settings({
                'width': 10,
                'weight': 1
              }),parent=self._main)
   self._dlabel = fbgui.Label("dlabel","Sa 04.05.2019",
                              settings=fbgui.Settings({
                                'font_size': self.theme.font_size_s,
                                'align': fbgui.CENTER
                              }),parent=self._main)
   self._tlabel = fbgui.Label("tlabel","14:23:12",
                              settings=fbgui.Settings({
                                'font_size': self.theme.font_size_xxl,
                                'align': fbgui.CENTER
                              }),parent=self._main)
   fbgui.VGap("gap2",
              settings=fbgui.Settings({
                'width': 10,
                'weight': 1
              }),parent=self._main)
Exemple #4
0
def get_widgets():
  """ create widget-tree """
    
  main = fbgui.Panel("main",
                      settings=fbgui.Settings({'margins': (10,10,10,10)}),
                      toplevel=True)
  # add VBox
  vbox = fbgui.VBox("vbox",
                      settings=fbgui.Settings({
                      'margins': 5,
                      'padding': 2,
                      'bg_color': fbgui.Color.SILVER,
                      'align':    (fbgui.LEFT,fbgui.TOP),
                      }),parent=main)

  # add three texts
  txt1 = fbgui.Label("id_txt1","this is",
                      settings=fbgui.Settings({
                      'font_size': FONT_SMALL,
                      'bg_color' : fbgui.Color.RED080,
                      'align':     fbgui.LEFT,
                      }),parent=vbox)
  txt2 = fbgui.Label("id_txt2","a small",
                      settings=fbgui.Settings({
                      'font_size': FONT_MEDIUM,
                      'bg_color' : fbgui.Color.GREEN080,
                      'align':     fbgui.CENTER,
                      }),parent=vbox)
  txt3 = fbgui.Label("id_txt1","and long text",
                      settings=fbgui.Settings({
                      'font_size': FONT_LARGE,
                      'align':     fbgui.RIGHT,
                      }),parent=vbox)
  return main
Exemple #5
0
    def _create_gui(self):
        """ create widget-tree """

        self._main_panel = fbgui.VBox("main",
                                      settings=fbgui.Settings({
                                          'margins': 2,
                                          'padding': 5
                                      }),
                                      toplevel=True)
        # add datetime
        self._dt = wstation.WSGuiDateTime("dt_hbox",
                                          settings=fbgui.Settings({
                                              'secs':
                                              False,
                                              'align':
                                              fbgui.CENTER,
                                              'stop_event':
                                              self._stop_event
                                          }),
                                          parent=self._main_panel)
        fbgui.Line("main_line_dt",
                   settings=fbgui.Settings({
                       'align': fbgui.CENTER,
                       'width': 0.9
                   }),
                   parent=self._main_panel)

        # add sensor-displays
        self._sensor_widgets = {}
        for group in self._sensors.keys():
            stype = self._sensors[group]['type']
            slabel = self._sensors[group]['label']
            # create GUI-object for stype
            fbgui.App.logger.msg(
                "DEBUG", "creating widget for %s (type: %s)" % (slabel, stype))

            self._sensor_widgets[group] = (wstation.__dict__["WSGui" + stype](
                "widget_" + group,
                settings=fbgui.Settings({
                    'align': fbgui.LEFT,
                    'name': group,
                    'group': self._sensors[group]
                }),
                parent=self._main_panel))
            # add a divider
            fbgui.Line("main_line_" + group,
                       settings=fbgui.Settings({
                           'align': fbgui.CENTER,
                           'width': 0.9
                       }),
                       parent=self._main_panel)
Exemple #6
0
def get_widgets():
    """ create widget-tree """

    main = fbgui.Panel("main",
                       settings=fbgui.Settings({'margins': (10, 10, 10, 10)}),
                       toplevel=True)
    # add VBox
    vbox = fbgui.VBox("vbox",
                      settings=fbgui.Settings({
                          'margins':
                          20,
                          'padding':
                          2,
                          'align': (fbgui.CENTER, fbgui.TOP),
                      }),
                      parent=main)

    # add a label
    label = fbgui.Label("msg",
                        "",
                        settings=fbgui.Settings({
                            'align': (fbgui.CENTER, fbgui.BOTTOM),
                        }),
                        parent=main)

    # add four buttons
    colors = [
        fbgui.Color.RED075, fbgui.Color.GREEN075, fbgui.Color.YELLOW,
        fbgui.Color.BLUE075
    ]
    text = ["play", "pause", "stop", "record"]
    images = ["play.png", "pause.png", "stop.png", "record.png"]
    attribs = zip(colors, text, images)
    index = 1
    for color, text, image in attribs:
        image = os.path.join(PGM_DIR, image)
        btn = fbgui.Button("btn_%d" % index,
                           img=image,
                           text=text,
                           settings=fbgui.Settings({
                               'width': 150,
                               'font_size': FONT_MEDIUM,
                               'bg_color': color,
                               'align': fbgui.CENTER,
                           }),
                           parent=vbox)
        btn.on_click = lambda widget, event, text=text: set_msg(
            widget, event, text, label)
        index += 1
    return main
Exemple #7
0
def get_widgets():
    """ create widget-tree """

    main = fbgui.VBox("main",
                      settings=fbgui.Settings({
                          'margins': (10, 10, 10, 10),
                          'padding': 20,
                      }),
                      toplevel=True)
    add_panels(main)
    add_lines(main)
    add_labels(main)
    add_images(main)
    return main
Exemple #8
0
 def _create_widgets(self):
     self._main = fbgui.Panel("main",
                              settings=fbgui.Settings({}),
                              toplevel=True)
     self._vbox = fbgui.VBox("vbox",
                             settings=fbgui.Settings({
                                 'margins':
                                 20,
                                 'radius':
                                 0.2,
                                 'align':
                                 fbgui.CENTER,
                                 'bg_color':
                                 fbgui.Color.SILVER,
                                 'padding':
                                 10
                             }),
                             parent=self._main)
     self._dlabel = fbgui.Label("dlabel",
                                "Sa 04.05.2019",
                                settings=fbgui.Settings({
                                    'font_size':
                                    self.theme.font_size_s,
                                    'align':
                                    fbgui.CENTER
                                }),
                                parent=self._vbox)
     self._tlabel = fbgui.Label("tlabel",
                                "14:23:12",
                                settings=fbgui.Settings({
                                    'font_name':
                                    "DSEG7Classic-Bold.ttf",
                                    'font_size':
                                    self.theme.font_size_xxl,
                                    'align':
                                    fbgui.CENTER
                                }),
                                parent=self._vbox)
Exemple #9
0
def get_gui():
    """ create GUI-elements """

    vbox = fbgui.VBox("main",
                      settings=fbgui.Settings({
                          'margins': 10,
                          'padding': 2
                      }),
                      toplevel=True)
    # first HBox
    zeile1 = fbgui.HBox(
        "img_and_title",
        settings=fbgui.Settings({
            'bg_color': fbgui.Color.CORNFLOWERBLUE,
            'radius': 0.1,
            'margins': 5,
            'padding': 5,
            'width': 1.0,  # 100%
            'weight': (0, 1),
            'align': fbgui.LEFT,
        }),
        parent=vbox)

    # elements of the first HBox
    bild = fbgui.Image("cover",
                       img="music.png",
                       settings=fbgui.Settings({
                           'align': fbgui.CENTER,
                           'min_size': (50, 50),
                           'scale': True,
                       }),
                       parent=zeile1)

    titel = fbgui.Label("title",
                        "Money for Nothing ...",
                        settings=fbgui.Settings({
                            'weight':
                            1,
                            'align': (fbgui.LEFT, fbgui.CENTER),
                        }),
                        parent=zeile1)

    # second HBox
    zeile2 = fbgui.HBox(
        "buttons1",
        settings=fbgui.Settings({
            'margins': 2,
            'padding': 1,
            'uniform': True,
            'width': 1.0,  # 100%
            'align': fbgui.CENTER,
        }),
        parent=vbox)

    # add buttons
    liste = [("pause.png", do_pause), ("start.png", do_start),
             ("stop.png", do_stop)]
    for icon, methode in liste:
        btn = fbgui.Button("%s" % icon,
                           img=icon,
                           settings=fbgui.Settings({
                               'margins':
                               5,
                               'padding':
                               1,
                               'bg_color':
                               fbgui.Color.CORNFLOWERBLUE
                           }),
                           parent=zeile2)
        btn.on_click = methode

    # third HBox
    zeile3 = fbgui.HBox(
        "buttons2",
        settings=fbgui.Settings({
            'margins': 2,
            'padding': 1,
            'uniform': True,
            'width': 1.0,  # 100%
            'align': fbgui.CENTER,
        }),
        parent=vbox)

    # add buttons
    liste = [("skip-backward.png", do_skip_back),
             ("seek-backward.png", do_seek_back),
             ("seek-forward.png", do_seek_fwd),
             ("skip-forward.png", do_skip_fwd)]
    for icon, methode in liste:
        btn = fbgui.Button("%s" % icon,
                           img=icon,
                           settings=fbgui.Settings({
                               'margins': 5,
                               'padding': 1,
                               'bg_color': fbgui.Color.CORNFLOWERBLUE,
                               'weight': 1
                           }),
                           parent=zeile3)
        btn.on_click = methode

    # return toplevel-element
    return vbox