Exemplo n.º 1
0
 def __init__(self, msg):
     super(_ProgressDialog, self).__init__('Amazon')
     self.sl_progress = pyxbmct.Slider(textureback=OSPJoin(g.PLUGIN_PATH, 'resources', 'art', 'transp.png'))
     self.btn_cancel = pyxbmct.Button(getString(30123))
     self.tb_msg = pyxbmct.TextBox()
     self.iscanceled = False
     self.connect(self.btn_cancel, self.cancel)
     self.setGeometry(500, 400, 6, 3)
     self.placeControl(self.tb_msg, 0, 0, 4, 3)
     self.placeControl(self.sl_progress, 4, 0, 0, 3)
     self.placeControl(self.btn_cancel, 5, 1, 1, 1)
     self.tb_msg.setText(msg)
     self.sl_progress.setEnabled(False)
 def set_sliderG(self):
     # Slider value label
     SLIDER_INIT_VALUE = self.active_RGB[1]
     self.slider_valueG = pyxbmct.Label('[COLOR FF00FF00]' +
                                        str(SLIDER_INIT_VALUE) + '[/COLOR]',
                                        alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.slider_valueG, 1, 1)
     #
     slider_caption = pyxbmct.Label(translate(30008),
                                    alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(slider_caption, 1, 0)
     # Slider
     self.sliderG = pyxbmct.Slider()
     self.placeControl(self.sliderG, 1, 2, pad_y=10, columnspan=2)
     # self.slider.setPercent(SLIDER_INIT_VALUE)
     self.sliderG.setInt(SLIDER_INIT_VALUE, -10, 5, 255)
Exemplo n.º 3
0
    def add_seekbar(self, percentage):
        """
        Add seekbar to the dialog window
        :param percentage: number of % of already played media
        :type percentage: float
        :return: None
        """

        self.seek_slider = pyxbmct.Slider()
        self.placeControl(self.seek_slider,
                          row=11,
                          column=0,
                          rowspan=1,
                          columnspan=16)
        max_width = self.seek_slider.getWidth()
        self.progress_bar = ProgressBar(filename=image("progress.png"),
                                        max_width=max_width)
        self.placeControl(self.progress_bar,
                          row=11,
                          column=0,
                          rowspan=1,
                          columnspan=16)
        self.set_percentage(percentage)
Exemplo n.º 4
0
 def set_active_controls(self):
     int_label = pyxbmct.Label('Interactive Controls',
                               alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(int_label, 0, 2, 1, 2)
     #
     radiobutton_label = pyxbmct.Label('RadioButton')
     self.placeControl(radiobutton_label, 1, 2)
     # RadioButton
     self.radiobutton = pyxbmct.RadioButton('Off')
     self.placeControl(self.radiobutton, 1, 3)
     self.connect(self.radiobutton, self.radio_update)
     #
     edit_label = pyxbmct.Label('Edit')
     self.placeControl(edit_label, 2, 2)
     # Edit
     self.edit = pyxbmct.Edit('Edit')
     self.placeControl(self.edit, 2, 3)
     # Additional properties must be changed after (!) displaying a control.
     self.edit.setText('Enter text here')
     #
     list_label = pyxbmct.Label('List')
     self.placeControl(list_label, 3, 2)
     #
     self.list_item_label = pyxbmct.Label('', textColor='0xFF808080')
     self.placeControl(self.list_item_label, 4, 2)
     # List
     self.list = pyxbmct.List()
     self.placeControl(self.list, 3, 3, 3, 1)
     # Add items to the list
     items = ['Item {0}'.format(i) for i in range(1, 8)]
     self.list.addItems(items)
     # Connect the list to a function to display which list item is selected.
     self.connect(
         self.list, lambda: xbmc.executebuiltin(
             'Notification(Note!,{0} selected.)'.format(
                 self.list.getListItem(self.list.getSelectedPosition()).
                 getLabel())))
     # Connect key and mouse events for list navigation feedback.
     self.connectEventList([
         pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP,
         pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP,
         pyxbmct.ACTION_MOUSE_MOVE
     ], self.list_update)
     # Slider value label
     SLIDER_INIT_VALUE = 25.0
     self.slider_value = pyxbmct.Label(str(SLIDER_INIT_VALUE),
                                       alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.slider_value, 6, 3)
     #
     slider_caption = pyxbmct.Label('Slider')
     self.placeControl(slider_caption, 7, 2)
     # Slider
     self.slider = pyxbmct.Slider()
     self.placeControl(self.slider, 7, 3, pad_y=10)
     self.slider.setPercent(SLIDER_INIT_VALUE)
     # Connect key and mouse events for slider update feedback.
     self.connectEventList([
         pyxbmct.ACTION_MOVE_LEFT, pyxbmct.ACTION_MOVE_RIGHT,
         pyxbmct.ACTION_MOUSE_DRAG, pyxbmct.ACTION_MOUSE_LEFT_CLICK
     ], self.slider_update)
     #
     button_label = pyxbmct.Label('Button')
     self.placeControl(button_label, 8, 2)
     # Button
     self.button = pyxbmct.Button('Close')
     self.placeControl(self.button, 8, 3)
     # Connect control to close the window.
     self.connect(self.button, self.close)
Exemplo n.º 5
0
    def __init__(self, title, cast, thumb, show_seekbar, percentage=0):
        """
        :param title: text for window header
        :type title: str
        :param cast: connected cast device
        :type cast: pychromecast.Chromecast
        :param thumb: path to thumbnail of currently playing video.
            Will be set as background of content part of the window
        :type thumb: str
        :param show_seekbar: show slider for seeking to the given
            position of the media
        :type show_seekbar: bool
        :param percentage: % of already played media
        :type percentage: float
        """

        super(CastControlsDialog, self).__init__(title)
        self.cast = cast
        self.setGeometry(WINDOW_WIDTH, WINDOW_HEIGHT, NUM_ROWS, NUM_COLUMNS)
        self.thumb = pyxbmct.Image(thumb, aspectRatio=2)
        self.placeControl(self.thumb,
                          row=0,
                          column=0,
                          rowspan=12,
                          columnspan=16)
        self.playing = True
        self.pause_button = pyxbmct.Button(label="",
                                           focusTexture=image("pauseFO.png"),
                                           noFocusTexture=image("pauseNF.png"))
        self.placeControl(self.pause_button,
                          row=4,
                          column=6,
                          rowspan=4,
                          columnspan=4)
        self.connect(self.pause_button, self.pause_button_pressed)
        self.play_button = pyxbmct.Button(label="",
                                          focusTexture=image("playFO.png"),
                                          noFocusTexture=image("playNF.png"))
        self.placeControl(self.play_button,
                          row=4,
                          column=6,
                          rowspan=4,
                          columnspan=4)
        self.play_button.setVisible(False)
        self.connect(self.play_button, self.play_button_pressed)
        if show_seekbar:
            self.add_seekbar(percentage)
        self.stop_button = pyxbmct.Button(label="Stop casting")
        self.placeControl(self.stop_button,
                          row=9,
                          column=12,
                          rowspan=2,
                          columnspan=4)
        self.connect(self.stop_button, self.close)
        self.volume_icon = pyxbmct.Image(image("VolumeIcon.png"))
        self.placeControl(self.volume_icon,
                          row=0,
                          column=14,
                          rowspan=1,
                          columnspan=1)
        self.volume_slider = pyxbmct.Slider()
        self.placeControl(self.volume_slider,
                          row=1,
                          column=13,
                          rowspan=1,
                          columnspan=3)
        if self.cast.status:
            self.volume_slider.setPercent(self.cast.status.volume_level * 100)
        else:
            self.volume_slider.setPercent(100)