Beispiel #1
0
 def init_global_controls(self):
     self.log('init_global_controls start')
     loading_img = xbmc.validatePath('/'.join(
         (ADDON_PATH, 'resources', 'media', 'loading.gif')))
     logo_img = xbmc.validatePath('/'.join(
         (ADDON_PATH, 'resources', 'media', 'logo.png')))
     self.loading_control = ControlImage(480, 250, 400, 219, loading_img)
     self.preload_control = ControlImage(-1, -1, 1, 1, '')
     self.background_control = ControlImage(0, 0, 1280, 720, '')
     self.logo_control = ControlImage(25, 625, 250, 65, logo_img)
     self.logo_label = ControlLabel(98,
                                    680,
                                    250,
                                    25,
                                    '',
                                    textColor='FFFFFFFF')
     self.global_controls = [
         self.preload_control, self.background_control,
         self.loading_control, self.logo_control, self.logo_label
     ]
     self.xbmc_window.addControls(self.global_controls)
     self.log('init_global_controls end')
Beispiel #2
0
 def display_progress_bar(self, function='true'):
     if function == 'true':
         self.img_progress = ControlImage(340,
                                          640,
                                          600,
                                          20,
                                          '',
                                          aspectRatio=0,
                                          colorDiffuse="0xFF00AACC")
         self.addControl(self.img_progress)
         self.img_progress.setVisible(False)
         self.img_progress.setImage(self.image_progress)
         self.img_progress.setAnimations([
             ('conditional',
              'effect=fade start=0 end=100 time=500 condition=Control.IsVisible(%d)'
              % self.img_progress.getId()),
             ('conditional',
              'effect=fade start=100 end=0 time=300 condition=!Control.IsEnabled(%d)'
              % self.img_progress.getId())
         ])
         self.img_progress.setVisible(True)
         img_progressx = int((self.screenx / 3) - (200 / 2))
         img_progressy = int((self.screeny / 3) - (50 / 2) + 270)
         self.please_wait_textbox = ControlLabel(img_progressx,
                                                 img_progressy,
                                                 200,
                                                 50,
                                                 label='Please wait...',
                                                 textColor='0xFFFFFFFF',
                                                 alignment=2 | 4)
         self.addControl(self.please_wait_textbox)
     elif function == 'visible':
         self.please_wait_textbox.setVisible(True)
         self.img_progress.setEnabled(True)
         self.img_progress.setVisible(True)
     else:
         self.please_wait_textbox.setVisible(False)
         self.img_progress.setEnabled(False)
         self.img_progress.setVisible(False)
Beispiel #3
0
    def __init__(self,
                 w=0.5,
                 h=0.15,
                 y_offset=0,
                 label_padding=15,
                 label_h=43):
        window_width, window_height = get_resolution()
        self._window = Window(WINDOW_FULLSCREEN_VIDEO)
        self._shown = False

        logging.debug("Using window width=%d and height=%d", window_width,
                      window_height)
        total_label_h = 3 * label_h
        w = int(w * window_width)
        h = max(int(h * window_height), total_label_h + 2 * label_padding)
        x = (window_width - w) // 2
        y = int((3 * window_height / 4) - (h / 2) + 0.5) + y_offset

        label_x = x + label_padding
        label_w = w - 2 * label_padding
        label_y = y + int((h - total_label_h) / 2 + 0.5)
        self._label1 = ControlLabel(label_x,
                                    label_y,
                                    label_w,
                                    label_h,
                                    "",
                                    alignment=0x2 | 0x4)
        label_y += label_h
        self._label2 = ControlLabel(label_x,
                                    label_y,
                                    label_w,
                                    label_h,
                                    "",
                                    alignment=0x2 | 0x4)
        label_y += label_h
        self._label3 = ControlLabel(label_x,
                                    label_y,
                                    label_w,
                                    label_h,
                                    "",
                                    alignment=0x2 | 0x4)
        # ControlImage won't work with unicode special characters
        self._background = ControlImage(x,
                                        y,
                                        0,
                                        0,
                                        assure_str(
                                            os.path.join(
                                                ADDON_PATH, "resources",
                                                "images", "black.png")),
                                        colorDiffuse="0xD0000000")
        self._controls = [
            self._background, self._label1, self._label2, self._label3
        ]
        self._window.addControls(self._controls)
        # We are only able to update visibility after adding elements, so to make them not visible
        # we have to create them with 0 width and height and then update the controls after adding
        # them to the window
        for c in self._controls:
            c.setVisible(self._shown)
        self._background.setWidth(w)
        self._background.setHeight(h)
Beispiel #4
0
    def display_gauge_test(self, function='true'):
        if function == 'true':

            img_gaugex = int((self.screenx / 3) - (548 / 2))
            img_gaugey = int((self.screeny / 3) - (400 / 2))

            img_gauge_arrowx = int((self.screenx / 3) - (66 / 2) - 5)
            img_gauge_arrowy = int((self.screeny / 3) - (260 / 2) - 60)
            self.img_gauge = ControlImage(img_gaugex,
                                          img_gaugey,
                                          548,
                                          400,
                                          '',
                                          aspectRatio=0)
            self.img_gauge_arrow = ControlImage(img_gauge_arrowx,
                                                img_gauge_arrowy,
                                                66,
                                                260,
                                                '',
                                                aspectRatio=0)
            self.addControl(self.img_gauge)
            self.addControl(self.img_gauge_arrow)
            self.img_gauge.setVisible(False)
            self.img_gauge_arrow.setVisible(False)
            self.img_gauge.setImage(self.image_gauge)
            self.img_gauge_arrow.setImage(self.image_gauge_arrow)
            self.img_gauge.setAnimations([
                ('conditional',
                 'effect=fade start=0 end=100 delay=1000 time=1000 condition=Control.IsVisible(%d)'
                 % self.img_gauge.getId()),
                ('conditional',
                 'effect=fade start=100 end=0 time=300 condition=!Control.IsEnabled(%d)'
                 % self.img_gauge.getId())
            ])
            self.img_gauge_arrow.setAnimations([
                ('conditional',
                 'effect=fade start=0 end=100 time=1000 condition=Control.IsVisible(%d)'
                 % self.img_gauge_arrow.getId()),
                ('conditional',
                 'effect=fade start=100 end=0 time=300 condition=!Control.IsEnabled(%d)'
                 % self.img_gauge_arrow.getId())
            ])

            dlul_prog_textboxx = int((self.screenx / 3) - (200 / 2))
            dlul_prog_textboxy = int((self.screeny / 3) - (50 / 2) + 170)
            self.dlul_prog_textbox = ControlLabel(dlul_prog_textboxx,
                                                  dlul_prog_textboxy,
                                                  200,
                                                  50,
                                                  label='',
                                                  textColor='0xFFFFFFFF',
                                                  font='font30',
                                                  alignment=2 | 4)
            self.addControl(self.dlul_prog_textbox)
        elif function == 'visible':
            self.img_gauge.setEnabled(True)
            self.img_gauge.setVisible(True)
            self.img_gauge_arrow.setEnabled(True)
            self.img_gauge_arrow.setVisible(True)
        else:
            self.img_gauge.setEnabled(False)
            self.img_gauge.setVisible(False)
            self.img_gauge_arrow.setEnabled(False)
            self.img_gauge_arrow.setVisible(False)
            self.dlul_prog_textbox.setLabel('')