def __init__(self,
                 pixbuf,
                 title,
                 has_separator=True,
                 text_size=TITLE_FONT_SIZE,
                 text_color=app_theme.get_color("globalTitleForeground"),
                 width=222,
                 left_padding=0,
                 spacing=10):
        gtk.VBox.__init__(self)
        self.set_size_request(width, -1)

        hbox = gtk.HBox(spacing=spacing)
        label = Label(title,
                      text_color,
                      text_size,
                      enable_select=False,
                      enable_double_click=False)

        if pixbuf == None:
            self.__box_pack_start(hbox, [label])
        else:
            image_box = ImageBox(pixbuf)
            self.__box_pack_start(hbox, [image_box, label])

        align = style.wrap_with_align(hbox, align="left")

        self.__box_pack_start(self, [align])
        if has_separator:
            separator = HSeparator(
                app_theme.get_shadow_color("hSeparator").get_color_info(), 0,
                0)
            separator.set_size_request(-1, 10)
            self.__box_pack_start(self, [separator])
    def __init__(self, 
                 pixbuf, 
                 title,
                 has_separator=True,
                 text_size=TITLE_FONT_SIZE,
                 text_color=app_theme.get_color("globalTitleForeground"), 
                 width=222,
                 left_padding = 0,
                 spacing=10):
        gtk.VBox.__init__(self)
        self.set_size_request(width, -1)
        
        hbox = gtk.HBox(spacing=spacing)
        label = Label(title, 
                      text_color,
                      text_size,
                      enable_select=False,
                      enable_double_click=False)

        if pixbuf == None:
            self.__box_pack_start(hbox, [label])
        else:
            image_box = ImageBox(pixbuf)
            self.__box_pack_start(hbox, [image_box,label])

        align = style.wrap_with_align(hbox, align="left")

        self.__box_pack_start(self, [align])
        if has_separator:
            separator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
            separator.set_size_request(-1, 10)
            self.__box_pack_start(self, [separator])
    def __init_values(self):
        hseparator_color = [(0,   ("#777777", 0.0)),
                            (0.5, ("#000000", 0.3)),
                            (1,   ("#777777", 0.0))
                           ]
        self.height = 0
        self.size_check = False
        self.hbox = gtk.HBox()
        self.title_image = gtk.image_new_from_file(os.path.join(image_path, "image/usb/usb_label.png"))
        self.title_label = gtk.Label(_("Storage Device"))
        #self.title_label.connect("expose-event", self.title_label_expose_event)
        self.title_label_ali = gtk.Alignment(0, 0, 0, 0)
        self.title_label_ali.set_padding(0, 0, 0, 0)
        self.title_label_ali.add(self.title_label)
        
        self.hbox.pack_start(self.title_image, False, False)
        self.hbox.pack_start(self.title_label_ali, True, True)

        self.h_separator_top = HSeparator(hseparator_color, 0, 0)
        self.h_separator_ali = gtk.Alignment(1, 1, 1, 1)
        self.h_separator_ali.set_padding(5, 10, 0, 0)
        self.h_separator_ali.add(self.h_separator_top)

        self.monitor_vbox = gtk.VBox()
        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.hbox, False, False)
        self.vbox.pack_start(self.h_separator_ali, True, True)
        self.vbox.pack_start(self.monitor_vbox, True, True)

        self._ask_confirmed = False
        self.monitor = gio.VolumeMonitor()
        self.op = gio.MountOperation()        
def get_separator():
    hseparator = HSeparator(
        app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
    # hseparator.set_size_request(500, 10)
    align = gtk.Alignment()
    align.set_padding(10, 10, 14, 0)
    align.set(0, 0, 1, 1)
    align.add(hseparator)
    return align
示例#5
0
 def __init__(self, power_settings):
     gtk.VBox.__init__(self)
     self.power_settings = power_settings
     self.hbox = gtk.HBox()
     # init top widgets.
     self.icon = vtk_theme.name.get_image("power/power_icon.png") 
     self.label = gtk.Label(_("Power"))
     self.label.connect("expose-event", self.label_expose_event)
     self.hbox.pack_start(self.icon, False, False) 
     self.hbox.pack_start(self.label, False, False)
     # init mid widgets.
     self.top_line_ali = gtk.Alignment(1.0, 1.0, 1.0, 1.0)
     self.top_line_ali.set_padding(5, 5, 0, 0)
     self.top_line = HSeparator(HSEPARATOR_COLOR, 0, 0) 
     self.top_line_ali.add(self.top_line)
     self.one_mode_btn = SelectButton(_("Balanced"), ali_padding=125)
     self.two_mode_btn = SelectButton(_("Power saver"), ali_padding=125)
     self.tree_mode_btn = SelectButton(_("High performance"), ali_padding=125)
     self.customized_mode_btn = SelectButton(_("Custom"), ali_padding=125)
     self.one_mode_btn.connect("clicked", self.one_mode_btn_clicked)
     self.two_mode_btn.connect("clicked", self.two_mode_btn_clicked)
     self.tree_mode_btn.connect("clicked", self.tree_mode_btn_clicked)
     self.customized_mode_btn.connect("clicked", self.__on_customized_mode_btn_clicked)
     self.mode_height = 25
     self.one_mode_btn.set_size_request(-1, self.mode_height)
     self.two_mode_btn.set_size_request(-1, self.mode_height)
     self.tree_mode_btn.set_size_request(-1, self.mode_height)
     self.customized_mode_btn.set_size_request(-1, self.mode_height)
     # init bottom widgets
     self.bottom_line_ali = gtk.Alignment(1.0, 1.0, 1.0, 1.0)
     self.bottom_line_ali.set_padding(5, 5, 0, 0)
     self.bottom_line = HSeparator(HSEPARATOR_COLOR, 0, 0)
     self.bottom_line_ali.add(self.bottom_line)
     self.click_btn = SelectButton(_("Advanced..."), ali_padding=5)
     self.click_btn.set_size_request(-1, 25)
     # add all widgets.
     self.pack_start(self.hbox, False, False)
     self.pack_start(self.top_line_ali, False, False)
     self.pack_start(self.one_mode_btn, False, False)
     self.pack_start(self.two_mode_btn, False, False)
     self.pack_start(self.tree_mode_btn, False, False)
     self.pack_start(self.customized_mode_btn, False, False)
     self.pack_start(self.bottom_line_ali, False, False)
     self.pack_start(self.click_btn, False, False)
    def __init__(self, account_setting):
        super(IconEditPage, self).__init__(False)
        self.account_setting = account_setting
        self.error_label = Label("", label_width=350, enable_select=False, enable_double_click=False)

        left_align = gtk.Alignment()
        right_align = gtk.Alignment()
        left_align.set_padding(0, 0, 0, 60)
        #right_align.set_padding(0, 0, 0, 60)

        left_vbox = gtk.VBox(False)
        right_vbox = gtk.VBox(False)
        left_vbox.set_spacing(BETWEEN_SPACING)
        right_vbox.set_spacing(BETWEEN_SPACING)

        left_align.add(left_vbox)
        right_align.add(right_vbox)

        self.draw_area = IconEditArea()
        hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
        hseparator.set_size_request(-1, 10)
        left_vbox.pack_start(tools.make_align(Label(_("Clip"),
                             app_theme.get_color("globalTitleForeground"),
                             text_size=TITLE_FONT_SIZE, enable_select=False,
                             enable_double_click=False)), False, False)
        left_vbox.pack_start(hseparator, False, False)
        left_vbox.pack_start(tools.make_align(self.draw_area, yalign=0.0, width=300, height=300))

        self.thumbnail_large = gtk.Image()
        self.thumbnail_mid = gtk.Image()
        self.thumbnail_small = gtk.Image()
        self.thumbnail_large.set_size_request(150, 150)
        self.thumbnail_mid.set_size_request(48, 48)
        self.thumbnail_small.set_size_request(24, 24)

        hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
        hseparator.set_size_request(-1, 10)
        right_vbox.pack_start(tools.make_align(Label(_("Preview"),
                              app_theme.get_color("globalTitleForeground"),
                              text_size=TITLE_FONT_SIZE, enable_select=False,
                              enable_double_click=False)), False, False)
        right_vbox.pack_start(hseparator, False, False)
        right_vbox.pack_start(tools.make_align(self.thumbnail_large), False, False)
        right_vbox.pack_start(tools.make_align(self.thumbnail_mid), False, False)
        right_vbox.pack_start(tools.make_align(self.thumbnail_small), False, False)
        right_vbox.pack_start(tools.make_align(self.error_label, yalign=0.0))

        self.pack_start(left_align, False, False)
        self.pack_start(right_align, False, False)
        self.connect("expose-event", self.draw_frame_border, left_align, right_align)
        self.draw_area.connect("pixbuf-changed", self.__on_pixbuf_changed_cb)
    def __init__(self, tray_obj=None):
        super(TrayGui, self).__init__(False)
        self.tray_obj = tray_obj

        self.stream_icon = app_theme.get_pixbuf("sound/device.png").get_pixbuf().scale_simple(16, 16, gtk.gdk.INTERP_TILES)
        self.stream_num = 0
        self.stream_list = {}    # stream widgets
        self.stream_process = {} # process id to stream widgets
        self.stream_mpris = {}   # stream id to mpris process id

        self.__mpris_total_height = 0
        self.mpris_base_height = 70
        self.mpris_list = {}     # mpris widgets
        self.mpris_stream = {}   # mpris process id to stream id
        self.mpris2 = Mpris2()
        self.mpris2.connect("new", self.mpris2_new_cb)
        self.mpris2.connect("removed", self.mpris2_removed_cb)
        self.mpris2.connect("changed", self.mpris2_changed_cb)

        self.__play_dingdong = Play(os.path.join(get_parent_dir(__file__, 1), 'dingdong.wav'))

        hbox = gtk.HBox(False)
        hbox.set_spacing(WIDGET_SPACING)
        #separator_color = [(0, ("#000000", 0.3)), (0.5, ("#000000", 0.2)), (1, ("#777777", 0.0))]
        #hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
        #hseparator.set_size_request(150, 3)
        separator_color = [(0, ("#777777", 0.0)), (0.5, ("#000000", 0.3)), (1, ("#777777", 0.0))]
        hseparator = HSeparator(separator_color, 0, 0)
        hseparator.set_size_request(140, 5)
        #hbox.pack_start(self.__make_align(Label(_("Device"), enable_select=False, enable_double_click=False)), False, False)
        #hbox.pack_start(self.__make_align(hseparator), True, True)
        self.pack_start(self.__make_align(Label(_("Device"), enable_select=False, enable_double_click=False), height=-1), False, False)
        self.pack_start(self.__make_align(hseparator, xalign=0.5, height=5), False, False)

        volume_max_percent = pypulse.MAX_VOLUME_VALUE * 100 / pypulse.NORMAL_VOLUME_VALUE

        table = gtk.Table(2, 3)
        speaker_img = ImageBox(app_theme.get_pixbuf("sound/speaker-3.png"))
        self.speaker_scale = HScalebar(show_value=False, format_value="%", value_min=0, value_max=volume_max_percent)
        self.speaker_scale.set_magnetic_values([(0, 5), (100, 5), (volume_max_percent, 5)])
        self.speaker_scale.set_size_request(90, 10)
        self.speaker_mute_button = SwitchButton(
            inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        table.attach(self.__make_align(speaker_img), 0, 1, 0, 1, 4)
        table.attach(self.__make_align(self.speaker_scale, yalign=0.0, yscale=1.0, padding_left=5, padding_right=5, height=25), 1, 2, 0, 1, 4)
        table.attach(self.__make_align(self.speaker_mute_button), 2, 3, 0, 1, 4)

        #microphone_img = ImageBox(app_theme.get_pixbuf("sound/microphone.png"))
        #self.microphone_scale = HScalebar(show_value=False, format_value="%", value_min=0, value_max=volume_max_percent)
        #self.microphone_scale.set_size_request(90, 10)
        #self.microphone_mute_button = SwitchButton(
            #inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            #active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        #table.attach(self.__make_align(microphone_img), 0, 1, 1, 2, 4)
        #table.attach(self.__make_align(self.microphone_scale, yalign=0.0, yscale=1.0, padding_left=5, padding_right=5, height=25), 1, 2, 1, 2, 4)
        #table.attach(self.__make_align(self.microphone_mute_button), 2, 3, 1, 2, 4)

        self.pack_start(table, False, False)

        self.__app_vbox = gtk.VBox(False)
        separator_color = [(0, ("#777777", 0.0)), (0.5, ("#000000", 0.3)), (1, ("#777777", 0.0))]
        hseparator = HSeparator(separator_color, 0, 0)
        hseparator.set_size_request(140, 5)
        self.__app_vbox.pack_start(self.__make_align(Label(_("Applications"), enable_select=False, enable_double_click=False)), False, False)
        self.__app_vbox.pack_start(self.__make_align(hseparator, xalign=0.5, height=5), False, False)

        self.__mpris_vbox = gtk.VBox(False)
        self.__app_vbox.pack_start(self.__mpris_vbox)
        self.pack_start(self.__app_vbox)

        hseparator = HSeparator(separator_color, 0, 0)
        hseparator.set_size_request(140, 7)
        self.pack_start(self.__make_align(hseparator, xalign=0.5, height=7), False, False)

        self.button_more = SelectButton(_("Advanced..."), font_size=10, ali_padding=5)
        self.button_more.set_size_request(-1, 25)
        self.pack_start(self.button_more, False, False)
        #self.pack_start(self.__make_align(height=10))
        ##########################################
        self.__fallback_sink_index = None
        self.__fallback_source_index = None
        state_cb_fun = {}
        state_cb_fun["server"] = self.__server_state_cb
        state_cb_fun["sink"] = self.__sink_state_cb
        #state_cb_fun["source"] = self.__source_state_cb
        state_cb_fun["sinkinput"] = self.__sinkinput_state_cb
        pypulse.PULSE.connect_to_pulse(state_cb_fun)
        self.__set_output_status()
        #self.__set_input_status()

        # widget signals
        self.speaker_mute_button.connect("toggled", self.speaker_toggled)
        #self.microphone_mute_button.connect("toggled", self.microphone_toggled)
        self.speaker_scale.connect("value-changed", self.speaker_scale_value_changed)
        self.speaker_scale.connect("button-release-event", lambda w, e: self.__play_dingdong.play())
        #self.microphone_scale.connect("value-changed", self.microphone_scale_value_changed)
        # pulseaudio signals
        pypulse.PULSE.connect("sink-removed", self.sink_removed_cb)
        #pypulse.PULSE.connect("source-removed", self.source_removed_cb)
        pypulse.PULSE.connect("sinkinput-removed", self.sinkinput_removed_cb)

        self.mpris2.get_mpris_list()
        self.mpris_num = len(self.mpris2.mpris_process.keys())
        if self.mpris_num == 0:
            self.__app_vbox.set_no_show_all(True)
 def __setup_separator(self):
     hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     hseparator.set_size_request(500, HSEPARATOR_HEIGHT)
     return hseparator
示例#9
0
 def __setup_separator(self):
     hseparator = HSeparator(
         app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     hseparator.set_size_request(100, 3)
     return hseparator
 def __make_separator(self):
     hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     hseparator.set_size_request(450, 10)
     return hseparator
示例#11
0
 def __setup_separator(self):
     hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     hseparator.set_size_request(500, HSEPARATOR_HEIGHT)
     return hseparator
 def add_separator(self, widget, height=10):
     h_separator = HSeparator(
         app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     h_separator.set_size_request(500, height)
     widget.pack_start(h_separator, False, False)
示例#13
0
def create_separator_box(padding_x=0, padding_y=0):
    separator_box = HSeparator(
        app_theme.get_shadow_color("hSeparator").get_color_info(), padding_x,
        padding_y)
    return separator_box
    def __init__(self, tray_obj=None):
        super(TrayGui, self).__init__(False)
        self.tray_obj = tray_obj

        self.stream_icon = app_theme.get_pixbuf("sound/device.png").get_pixbuf().scale_simple(16, 16, gtk.gdk.INTERP_TILES)
        self.stream_num = 0
        self.stream_list = {}    # stream widgets
        self.stream_process = {} # process id to stream widgets
        self.stream_mpris = {}   # stream id to mpris process id

        self.__mpris_total_height = 0
        self.mpris_base_height = 70
        self.mpris_list = {}     # mpris widgets
        self.mpris_stream = {}   # mpris process id to stream id
        self.mpris2 = Mpris2()
        self.mpris2.connect("new", self.mpris2_new_cb)
        self.mpris2.connect("removed", self.mpris2_removed_cb)
        self.mpris2.connect("changed", self.mpris2_changed_cb)

        hbox = gtk.HBox(False)
        hbox.set_spacing(WIDGET_SPACING)
        #separator_color = [(0, ("#000000", 0.3)), (0.5, ("#000000", 0.2)), (1, ("#777777", 0.0))]
        #hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
        #hseparator.set_size_request(150, 3)
        separator_color = [(0, ("#777777", 0.0)), (0.5, ("#000000", 0.3)), (1, ("#777777", 0.0))]
        hseparator = HSeparator(separator_color, 0, 0)
        hseparator.set_size_request(140, 5)
        #hbox.pack_start(self.__make_align(Label(_("Device"), enable_select=False, enable_double_click=False)), False, False)
        #hbox.pack_start(self.__make_align(hseparator), True, True)
        self.pack_start(self.__make_align(Label(_("Device"), enable_select=False, enable_double_click=False), height=-1), False, False)
        self.pack_start(self.__make_align(hseparator, xalign=0.5, height=5), False, False)

        volume_max_percent = pypulse.MAX_VOLUME_VALUE * 100 / pypulse.NORMAL_VOLUME_VALUE

        table = gtk.Table(2, 3)
        speaker_img = ImageBox(app_theme.get_pixbuf("sound/speaker-3.png"))
        self.speaker_scale = HScalebar(show_value=False, format_value="%", value_min=0, value_max=volume_max_percent)
        self.speaker_scale.set_magnetic_values([(0, 5), (100, 5), (volume_max_percent, 5)])
        self.speaker_scale.set_size_request(90, 10)
        self.speaker_mute_button = SwitchButton(
            inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        table.attach(self.__make_align(speaker_img), 0, 1, 0, 1, 4)
        table.attach(self.__make_align(self.speaker_scale, yalign=0.0, yscale=1.0, padding_left=5, padding_right=5, height=25), 1, 2, 0, 1, 4)
        table.attach(self.__make_align(self.speaker_mute_button), 2, 3, 0, 1, 4)

        #microphone_img = ImageBox(app_theme.get_pixbuf("sound/microphone.png"))
        #self.microphone_scale = HScalebar(show_value=False, format_value="%", value_min=0, value_max=volume_max_percent)
        #self.microphone_scale.set_size_request(90, 10)
        #self.microphone_mute_button = SwitchButton(
            #inactive_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
            #active_disable_dpixbuf=app_theme.get_pixbuf("toggle_button/inactive_normal.png"))
        #table.attach(self.__make_align(microphone_img), 0, 1, 1, 2, 4)
        #table.attach(self.__make_align(self.microphone_scale, yalign=0.0, yscale=1.0, padding_left=5, padding_right=5, height=25), 1, 2, 1, 2, 4)
        #table.attach(self.__make_align(self.microphone_mute_button), 2, 3, 1, 2, 4)

        self.pack_start(table, False, False)

        self.__app_vbox = gtk.VBox(False)
        separator_color = [(0, ("#777777", 0.0)), (0.5, ("#000000", 0.3)), (1, ("#777777", 0.0))]
        hseparator = HSeparator(separator_color, 0, 0)
        hseparator.set_size_request(140, 5)
        self.__app_vbox.pack_start(self.__make_align(Label(_("Applications"), enable_select=False, enable_double_click=False)), False, False)
        self.__app_vbox.pack_start(self.__make_align(hseparator, xalign=0.5, height=5), False, False)

        self.__mpris_vbox = gtk.VBox(False)
        self.__app_vbox.pack_start(self.__mpris_vbox)
        self.pack_start(self.__app_vbox)

        hseparator = HSeparator(separator_color, 0, 0)
        hseparator.set_size_request(140, 7)
        self.pack_start(self.__make_align(hseparator, xalign=0.5, height=7), False, False)

        self.button_more = SelectButton(_("Advanced..."), font_size=10, ali_padding=5)
        self.button_more.set_size_request(-1, 25)
        self.pack_start(self.button_more, False, False)
        #self.pack_start(self.__make_align(height=10))
        ##########################################
        self.__set_output_status()
        #self.__set_input_status()

        # widget signals
        self.speaker_mute_button.connect("toggled", self.speaker_toggled)
        #self.microphone_mute_button.connect("toggled", self.microphone_toggled)
        self.speaker_scale.connect("value-changed", self.speaker_scale_value_changed)
        #self.microphone_scale.connect("value-changed", self.microphone_scale_value_changed)
        # pulseaudio signals
        pypulse.PULSE.connect("sink-changed", self.sink_changed_cb)
        #pypulse.PULSE.connect("source-changed", self.source_changed_cb)
        pypulse.PULSE.connect("server-changed", self.server_changed_cb)
        pypulse.PULSE.connect("sink-input-new", self.sink_input_new_cb)
        pypulse.PULSE.connect("sink-input-changed", self.sink_input_changed_cb)
        pypulse.PULSE.connect("sink-input-removed", self.sink_input_removed_cb)
        playback_streams = pypulse.PULSE.get_playback_streams()
        self.stream_num = len(playback_streams.keys())
        self.mpris2.get_mpris_list()
        self.mpris_num = len(self.mpris2.mpris_process.keys())
        if self.stream_num == 0 and self.mpris_num == 0:
            self.__app_vbox.set_no_show_all(True)
        for stream in playback_streams:
            self.__make_playback_box(playback_streams[stream], stream)
def add_separator(container, height=HSEPARATOR_HEIGHT):
        h_separator = HSeparator(MYHSEPARATOR_COLOR, 0, 0)
        h_separator.set_size_request(-1, height)
        h_separator.set(0, 0.5, 1, 0)
        container.pack_start(h_separator, False, False)
def add_separator(container, height=HSEPARATOR_HEIGHT):
    h_separator = HSeparator(MYHSEPARATOR_COLOR, 0, 0)
    h_separator.set_size_request(-1, height)
    h_separator.set(0, 0.5, 1, 0)
    container.pack_start(h_separator, False, False)
 def add_separator(self, widget, height=10):
     h_separator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     h_separator.set_size_request(500, height)
     widget.pack_start(h_separator, False, False)
示例#18
0
    def __init__(self, account_setting):
        super(IconEditPage, self).__init__(False)
        self.account_setting = account_setting
        self.error_label = Label("",
                                 label_width=350,
                                 enable_select=False,
                                 enable_double_click=False)

        left_align = gtk.Alignment()
        right_align = gtk.Alignment()
        left_align.set_padding(0, 0, 0, 60)
        #right_align.set_padding(0, 0, 0, 60)

        left_vbox = gtk.VBox(False)
        right_vbox = gtk.VBox(False)
        left_vbox.set_spacing(BETWEEN_SPACING)
        right_vbox.set_spacing(BETWEEN_SPACING)

        left_align.add(left_vbox)
        right_align.add(right_vbox)

        self.draw_area = IconEditArea()
        hseparator = HSeparator(
            app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
        hseparator.set_size_request(-1, 10)
        left_vbox.pack_start(
            tools.make_align(
                Label(_("Clip"),
                      app_theme.get_color("globalTitleForeground"),
                      text_size=TITLE_FONT_SIZE,
                      enable_select=False,
                      enable_double_click=False)), False, False)
        left_vbox.pack_start(hseparator, False, False)
        left_vbox.pack_start(
            tools.make_align(self.draw_area, yalign=0.0, width=300,
                             height=300))

        self.thumbnail_large = gtk.Image()
        self.thumbnail_mid = gtk.Image()
        self.thumbnail_small = gtk.Image()
        self.thumbnail_large.set_size_request(150, 150)
        self.thumbnail_mid.set_size_request(48, 48)
        self.thumbnail_small.set_size_request(24, 24)

        hseparator = HSeparator(
            app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
        hseparator.set_size_request(-1, 10)
        right_vbox.pack_start(
            tools.make_align(
                Label(_("Preview"),
                      app_theme.get_color("globalTitleForeground"),
                      text_size=TITLE_FONT_SIZE,
                      enable_select=False,
                      enable_double_click=False)), False, False)
        right_vbox.pack_start(hseparator, False, False)
        right_vbox.pack_start(tools.make_align(self.thumbnail_large), False,
                              False)
        right_vbox.pack_start(tools.make_align(self.thumbnail_mid), False,
                              False)
        right_vbox.pack_start(tools.make_align(self.thumbnail_small), False,
                              False)
        right_vbox.pack_start(tools.make_align(self.error_label, yalign=0.0))

        self.pack_start(left_align, False, False)
        self.pack_start(right_align, False, False)
        self.connect("expose-event", self.draw_frame_border, left_align,
                     right_align)
        self.draw_area.connect("pixbuf-changed", self.__on_pixbuf_changed_cb)
 def __setup_separator(self):
     hseparator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
     hseparator.set_size_request(100, 3)
     return hseparator
示例#20
0
    def init_widgets(self):
        self.icon_width = self.icon_height = HEIGHT
        #
        self.user_hbox = gtk.HBox()
        self.user_icon = gtk.Image()
        self.user_icon.set_size_request(HEIGHT, HEIGHT)
        #
        user_name = self.cmd_dbus.get_user_name()
        user_name_width = get_text_size(user_name)[0]
        if user_name_width > WIDTH: 
            de_user_name = user_name.decode("utf-8")
            user_name = de_user_name[0:10] + "..."
        self.user_label_ali = gtk.Alignment(0, 0, 1, 1)
        self.user_label_ali.set_padding(0, 0, 5, 0)
        self.user_label_event = gtk.EventBox()
        self.user_label = gtk.Label(user_name)
        self.user_label_event.add(self.user_label)
        self.user_label_ali.add(self.user_label_event)
        self.user_icon.connect_after("expose-event", self.user_label_event_expose_event)
        #
        self.user_hbox.pack_start(self.user_icon, False, False)
        self.user_hbox.pack_start(self.user_label_ali, False, False)
        #
        self.h_separator_top_ali = gtk.Alignment(1, 1, 1, 1)
        self.h_separator_top_ali.set_padding(5, 5, 0, 0)
        hseparator_color = [(0, ("#777777", 0.0)),
                            (0.5, ("#000000", 0.3)), 
                            (1, ("#777777", 0.0))]
        self.h_separator_top = HSeparator(hseparator_color, 0, 0)
        self.h_separator_top_ali.add(self.h_separator_top)

        self.switch_separator_bottom = HSeparator(hseparator_color, 0, 0)
        self.switch_separator_bottom_ali = gtk.Alignment(1, 1, 1, 1)
        self.switch_separator_bottom_ali.set_padding(5, 5, 0, 0)
        self.switch_separator_bottom_ali.add(self.switch_separator_bottom)
        #
        ali_padding = 100  
        font_size = 10
        self.switch_btn = SelectButton(_("Switch user"), 
                                       font_size=font_size, 
                                       ali_padding=ali_padding)
        self.stop_btn = SelectButton(_("Shut down"), 
                                     font_size=font_size, 
                                     ali_padding=ali_padding)
        self.restart_btn = SelectButton(_("Restart"), 
                                        font_size=font_size, 
                                        ali_padding=ali_padding)
        self.suspend_btn = SelectButton(_("Suspend"), 
                                        font_size=font_size, 
                                        ali_padding=ali_padding)
        self.logout_btn = SelectButton(_("Log out"), 
                                       font_size=font_size, 
                                       ali_padding=ali_padding)
        self.lock_btn = SelectButton(_("Lock"), 
                                     font_size=font_size, 
                                     ali_padding=ali_padding)
        #
        self.switch_btn.set_size_request(WIDTH, HEIGHT)
        self.stop_btn.set_size_request(WIDTH, HEIGHT)
        self.restart_btn.set_size_request(WIDTH, HEIGHT)
        self.suspend_btn.set_size_request(WIDTH, HEIGHT)
        self.logout_btn.set_size_request(WIDTH, HEIGHT)
        self.lock_btn.set_size_request(WIDTH, HEIGHT)
        #
        self.pack_start(self.user_hbox, True, True)
        self.pack_start(self.h_separator_top_ali, True, True)
        self.pack_start(self.switch_btn, True, True)
        self.pack_start(self.switch_separator_bottom_ali, True, True)
        self.pack_start(self.stop_btn, True, True)
        self.pack_start(self.restart_btn, True, True)
        self.pack_start(self.suspend_btn, True, True)
        self.pack_start(self.logout_btn, True, True)

        if self.cmd_dbus.real_name != "Guest":
            self.pack_start(self.lock_btn, True, True)
        set_clickable_cursor(self.user_label_event)

        gobject.timeout_add_seconds(2, self.check_is_livecd)