def set_edit_mode(self, pixbuf):
     self.current_mode = self.MODE_EDIT
     self.__edit_picture(pixbuf)
     container_remove_all(self.button_hbox)
     self.button_hbox.pack_start(self.button_zoom_in_align)
     self.button_hbox.pack_start(self.button_zoom_out_align)
     self.button_hbox.show_all()
Exemple #2
0
 def add_items(self, child_items):
     if child_items:
         container_remove_all(self.child_box)
         for index, item in enumerate(child_items):
             simple_item = SimpleItem(item, index + 1, 9, 20, 35, 10, 25,
                                      self.set_index, self.get_index)
             self.child_box.pack_start(simple_item)
Exemple #3
0
    def __init__(self, data_manager):
        '''
        init docs
        '''
        # Init.
        gtk.VBox.__init__(self)
        self.in_detail_view = False
        self.data_manager = data_manager

        self.album_summary_align = gtk.Alignment()
        self.album_summary_align.set(0.5, 0.5, 1, 1)
        self.album_summary_align.set_padding(0, 0, 0, 10)

        self.album_detail_align = gtk.Alignment()
        self.album_detail_align.set(0.5, 0.5, 1, 1)
        self.album_detail_align.set_padding(5, 0, 0, 10)

        self.album_summary_view = AlbumSummaryView()
        self.loading_box = LoadingBox()
        self.network_failed_box = NetworkConnectFailed(
            self.check_network_connection)

        container_remove_all(self)
        self.add(self.loading_box)

        self.check_network_connection()
        global_event.register_event("switch-to-album-detail-view",
                                    self.switch_to_album_detail_view)
        global_event.register_event('switch-to-album-summary-view',
                                    self.switch_to_album_summary_view)
        global_event.register_event('switch-to-network-problem-view',
                                    self.switch_to_network_problem_view)
 def handle_pkg_status(self, reply, success):
     container_remove_all(self.left_action_box)
     if success:
         install_status = str(reply)
         print install_status
         if install_status == "installed":
             if not self.data_manager.get_pkg_desktop_info(self.pkg_name):
                 status_label = Label(_("Successfully installed"))
                 self.left_action_box.pack_start(status_label)
             else:
                 action_button = ImageButton(
                     app_theme.get_pixbuf("button/start_normal.png"),
                     app_theme.get_pixbuf("button/start_hover.png"),
                     app_theme.get_pixbuf("button/start_press.png"),
                     )
                 action_button.connect("button-press-event", self.button_press_start_button)
                 self.left_action_box.pack_start(action_button)
         elif install_status == "unknown":
             status_label = Label(_("Not found"))
             self.left_action_box.pack_start(status_label)
         else:
             action_button = ImageButton(
                 app_theme.get_pixbuf("button/install_normal.png"),
                 app_theme.get_pixbuf("button/install_hover.png"),
                 app_theme.get_pixbuf("button/install_press.png"),
                 )
             action_button.connect("clicked", lambda w: global_event.emit("install-pkg", [self.pkg_name]))
             self.left_action_box.pack_start(action_button)
         self.left_action_box.show_all()
         global_event.emit('update-current-status-pkg-page', self)
     else:
         global_logger.logerror("get_pkg_installed handle_dbus_error")
         global_logger.logerror(reply)
    def show_dialog(self,
                    show_pixbuf_name,
                    info_text,
                    ok_text=OK_TEXT,
                    cancel_text=CANCEL_TEXT,
                    ):
        self.show_pixbuf = vtk_theme.get_pixbuf(show_pixbuf_name, 50)
        self.info_text = info_text

        self.ok_button = BottomButton(ok_text, self.btn_text_size)
        self.ok_button.connect("clicked", self.ok_btn_clicked)
        self.ok_button.set_check(True)
        self.cancel_button = BottomButton(cancel_text, self.btn_text_size)
        self.cancel_button.connect("clicked", self.quit_dialog_window)
        container_remove_all(self.bottom_hbox)
        self.bottom_hbox.pack_end(self.ok_button, False, False)
        self.bottom_hbox.pack_end(self.cancel_button, False, False)

        self.second = 60
        self.argv = None
        self.run_exec = None
        
        self.set_pango_list()
        
        if self.show_pixbuf:
            self.show_image.set_from_pixbuf(self.show_pixbuf)
        self.tick_label.set_text(self.info_text % 60)

        self.timer.Enabled = True

        self.show_all()
        self.ok_button.grab_focus()
Exemple #6
0
    def __init__(self, data_manager):
        '''
        init docs
        '''
        # Init.
        gtk.VBox.__init__(self)
        self.in_detail_view = False
        self.data_manager = data_manager

        self.album_summary_align = gtk.Alignment()
        self.album_summary_align.set(0.5, 0.5, 1, 1)
        self.album_summary_align.set_padding(0, 0, 0, 10)

        self.album_detail_align = gtk.Alignment()
        self.album_detail_align.set(0.5, 0.5, 1, 1)
        self.album_detail_align.set_padding(5, 0, 0, 10)

        self.album_summary_view = AlbumSummaryView()
        self.loading_box = LoadingBox()
        self.network_failed_box = NetworkConnectFailed(self.check_network_connection)

        container_remove_all(self)
        self.add(self.loading_box)

        self.check_network_connection()
        global_event.register_event("switch-to-album-detail-view", self.switch_to_album_detail_view)
        global_event.register_event('switch-to-album-summary-view', self.switch_to_album_summary_view)
        global_event.register_event('switch-to-network-problem-view', self.switch_to_network_problem_view)
 def add_items(self, child_items):
     if child_items:
         container_remove_all(self.child_box)            
         for index, item in enumerate(child_items):
             simple_item = SimpleItem(
                 item, index + 1 , 9 , 20, 35, 10, 25, self.set_index, self.get_index)
             self.child_box.pack_start(simple_item)
Exemple #8
0
 def refresh(self):
     container_remove_all(self.camera_box)
     container_remove_all(self.under_camera_box)
     if Webcam.has_device():
         self.under_camera_box.pack_start(self.start_record_button)
     else:
         self.under_camera_box.pack_start(self.no_device_warning)
Exemple #9
0
    def reset_table(self):
        container_remove_all(self.table)
        mode = self.mode_combo.get_current_item()[1]

        #self.table.attach(self.ssid_label_align, 0, 1, 0, 1)
        #self.table.attach(self.ssid_entry_align, 1, 2, 0, 1)
        # Mode
        self.table.attach(self.mode_label_align, 0, 1, 1, 2)
        self.table.attach(self.mode_combo_align, 1, 2, 1, 2)
        if mode == "adhoc":
            self.table.attach(self.band_label_align, 0, 1, 2, 3)
            self.table.attach(self.band_combo_align, 1, 2, 2, 3)
            self.table.attach(self.channel_label_align, 0, 1, 3, 4)
            self.table.attach(self.channel_spin_align, 1, 2, 3, 4)

        # Bssid
        self.table.attach(self.bssid_label_align, 0, 1, 4, 5)
        self.table.attach(self.bssid_entry_align, 1, 2, 4, 5)

        # MAC
        self.table.attach(self.mac_address_label_align, 0, 1, 5, 6)
        self.table.attach(self.mac_entry_align, 1, 2, 5, 6)
        # MAC_CLONE
        self.table.attach(self.clone_addr_label_align, 0, 1, 6, 7)
        self.table.attach(self.clone_entry_align, 1, 2, 6, 7)
        # MTU
        self.table.attach(self.mtu_spin_align, 1, 2, 7, 8)
        self.table.attach(self.mtu_label_align, 0, 1, 7, 8)
Exemple #10
0
def switch_tab(notebook_box, tab_box):
    '''Switch tab 1.'''
    if not tab_box in notebook_box.get_children():
        container_remove_all(notebook_box)
        notebook_box.add(tab_box)

        notebook_box.show_all()
    def get_pkgs_status(self):
        if self.show_flag:
            infos = self.data_manager.get_download_rank_info(self.pkg_names)

            if len(infos) > 25:
                infos = infos[:25]

            valid_pkg_names = []
            for info in infos:
                valid_pkg_names.append(info[0])

            view = self.view_list[self.current_page_index][1]
            view.clear()
            container_remove_all(self.page_align)

            items = []
            for i in range(len(infos)):
                items.append(PkgIconItem(self.data_manager, *infos[i]))
            view.add_items(items)
            self.page_align.add(self.view_list[self.current_page_index][2])
            global_event.emit("update-current-status-pkg-page", view)
            self.show_all()

            self.show_flag = None
        return True
Exemple #12
0
def switch_tab(notebook_box, tab_box):
    '''Switch tab 1.'''
    if not tab_box in notebook_box.get_children():
        container_remove_all(notebook_box)
        notebook_box.add(tab_box)
    
        notebook_box.show_all()
 def refresh(self):
     container_remove_all(self.camera_box)
     container_remove_all(self.under_camera_box)
     if Webcam.has_device():
         self.under_camera_box.pack_start(self.start_record_button)
     else:
         self.under_camera_box.pack_start(self.no_device_warning)        
Exemple #14
0
    def fetch_comment(self):
        if is_network_connected():
            container_remove_all(self.right_comment_box)
            loading_label = Label(_("Loading comments..."))
            loading_label_align = gtk.Alignment(0.5, 0, 0, 0)
            loading_label_align.add(loading_label)
            loading_label_align.set_padding(10, 0, 0, 0)
            self.right_comment_box.pack_start(loading_label_align, False, False)
            web_view = WebView(os.path.join(CONFIG_DIR, "cookie.txt"))
            web_view.connect("new-window-policy-decision-requested", self.open_url)
            web_view.connect('console-message', self.webview_console_message_handler)
            web_view_align = gtk.Alignment()
            web_view_align.set(0.5, 0, 0, 0)
            web_view_align.set_padding(33, 33, 33, 33)
            web_view_align.add(web_view)
            web_settings = web_view.get_settings()
            web_settings.set_property("enable-plugins", False)
            web_settings.set_property("enable-scripts", True)
            web_view.open("%s/softcenter/v1/comment?n=%s&hl=%s" % (
                    SERVER_ADDRESS,
                    self.pkg_name,
                    LANGUAGE,
                    ))

            web_view.connect("load-finished", self.comment_load_finished_cb, web_view_align)

            create_thread(self.fetch_screenshot).start()
Exemple #15
0
 def set_edit_mode(self, pixbuf):
     self.current_mode = self.MODE_EDIT
     self.__edit_picture(pixbuf)
     container_remove_all(self.button_hbox)
     self.button_hbox.pack_start(self.button_zoom_in_align)
     self.button_hbox.pack_start(self.button_zoom_out_align)
     self.button_hbox.show_all()
Exemple #16
0
 def comment_load_finished_cb(self, webview, frame, web_view_align):
     self.scrolled_window.connect(
         "vscrollbar-state-changed",
         lambda w, p: self.load_more_comment(p, webview))
     container_remove_all(self.right_comment_box)
     self.right_comment_box.pack_start(web_view_align, True, True)
     self.right_comment_box.show_all()
Exemple #17
0
    def fetch_comment(self):
        if is_network_connected():
            container_remove_all(self.right_comment_box)
            loading_label = Label(_("Loading comments..."))
            loading_label_align = gtk.Alignment(0.5, 0, 0, 0)
            loading_label_align.add(loading_label)
            loading_label_align.set_padding(10, 0, 0, 0)
            self.right_comment_box.pack_start(loading_label_align, False,
                                              False)
            web_view = WebView(os.path.join(CONFIG_DIR, "cookie.txt"))
            web_view.connect("new-window-policy-decision-requested",
                             self.open_url)
            web_view.connect('console-message',
                             self.webview_console_message_handler)
            web_view_align = gtk.Alignment()
            web_view_align.set(0.5, 0, 0, 0)
            web_view_align.set_padding(33, 33, 33, 33)
            web_view_align.add(web_view)
            web_settings = web_view.get_settings()
            web_settings.set_property("enable-plugins", False)
            web_settings.set_property("enable-scripts", True)
            web_view.open("%s/softcenter/v1/comment?n=%s&hl=%s" % (
                SERVER_ADDRESS,
                self.pkg_name,
                LANGUAGE,
            ))

            web_view.connect("load-finished", self.comment_load_finished_cb,
                             web_view_align)

            create_thread(self.fetch_screenshot).start()
Exemple #18
0
    def show_dialog(
        self,
        show_pixbuf_name,
        info_text,
        ok_text=OK_TEXT,
        cancel_text=CANCEL_TEXT,
    ):
        self.show_pixbuf = vtk_theme.get_pixbuf(show_pixbuf_name, 50)
        self.info_text = info_text

        self.ok_button = BottomButton(ok_text, self.btn_text_size)
        self.ok_button.connect("clicked", self.ok_btn_clicked)
        self.ok_button.set_check(True)
        self.cancel_button = BottomButton(cancel_text, self.btn_text_size)
        self.cancel_button.connect("clicked", self.quit_dialog_window)
        container_remove_all(self.bottom_hbox)
        self.bottom_hbox.pack_end(self.ok_button, False, False)
        self.bottom_hbox.pack_end(self.cancel_button, False, False)

        self.second = 60
        self.argv = None
        self.run_exec = None

        self.set_pango_list()

        if self.show_pixbuf:
            self.show_image.set_from_pixbuf(self.show_pixbuf)
        self.tick_label.set_text(self.info_text % 60)

        self.timer.Enabled = True

        self.show_all()
        self.ok_button.grab_focus()
    def reset_table(self):
        container_remove_all(self.table)
        mode = self.mode_combo.get_current_item()[1]

        #self.table.attach(self.ssid_label_align, 0, 1, 0, 1)
        #self.table.attach(self.ssid_entry_align, 1, 2, 0, 1)
        # Mode
        self.table.attach(self.mode_label_align, 0, 1, 1, 2)
        self.table.attach(self.mode_combo_align, 1, 2, 1, 2)
        if mode == "adhoc":
            self.table.attach(self.band_label_align, 0, 1, 2, 3)
            self.table.attach(self.band_combo_align, 1, 2, 2, 3)
            self.table.attach(self.channel_label_align, 0, 1, 3, 4)
            self.table.attach(self.channel_spin_align, 1, 2, 3, 4)

        # Bssid
        self.table.attach(self.bssid_label_align, 0, 1, 4, 5)
        self.table.attach(self.bssid_entry_align, 1, 2, 4, 5)

        # MAC
        self.table.attach(self.mac_address_label_align, 0, 1, 5, 6)
        self.table.attach(self.mac_entry_align, 1, 2, 5, 6)
        # MAC_CLONE
        self.table.attach(self.clone_addr_label_align, 0, 1, 6, 7)
        self.table.attach(self.clone_entry_align, 1,2, 6, 7)
        # MTU
        self.table.attach(self.mtu_spin_align, 1, 2, 7, 8)
        self.table.attach(self.mtu_label_align, 0, 1, 7, 8)
 def handle_pkg_status(self, *reply):
     container_remove_all(self.left_action_box)
     install_status = reply
     if install_status[0][0]:
         if not self.data_manager.get_pkg_desktop_info(self.pkg_name):
             status_label = Label(_("Successfully installed"))
             self.left_action_box.pack_start(status_label)
         else:
             action_button = ImageButton(
                 app_theme.get_pixbuf("button/start_normal.png"),
                 app_theme.get_pixbuf("button/start_hover.png"),
                 app_theme.get_pixbuf("button/start_press.png"),
                 )
             action_button.connect("button-press-event", self.button_press_start_button)
             self.left_action_box.pack_start(action_button)
     else:
         action_button = ImageButton(
             app_theme.get_pixbuf("button/install_normal.png"),
             app_theme.get_pixbuf("button/install_hover.png"),
             app_theme.get_pixbuf("button/install_press.png"),
             )
         action_button.connect("clicked", lambda w: global_event.emit("install-pkg", [self.pkg_name]))
         self.left_action_box.pack_start(action_button)
     self.left_action_box.show_all()
     global_event.emit('update-current-status-pkg-page', self)
    def update_rank_page(self, page_index):
        container_remove_all(self.page_align)
        self.current_page_index = page_index

        self.page_align.add(self.loading)

        ThreadMethod(self.get_rank_pkg_names, (self.view_list[page_index][0],)).start()
        self.show_all()
 def __remove_all_items(self):
     if not self.get_children():
         log.debug("not items", self)
         return
     for c in self.get_children():
         log.debug(c)
         container_remove_all(c)
     container_remove_all(self)
 def __remove_all_items(self):
     if not self.get_children():
         log.debug("not items", self)
         return
     for c in self.get_children():
         log.debug(c)
         container_remove_all(c)
     container_remove_all(self)
 def __init_tree(self, items_list, insert_pos=None):
     if items_list and items_list != [None, -1]:
         container_remove_all(self.buttonbox)
         self.connection_tree.add_items(map(lambda c: SettingItem(c, None),
                                            items_list),
                                        insert_pos=insert_pos)
         self.buttonbox.pack_start(self.connection_tree, False, False)
         self.resize_tree()
 def resize_tree(self):
     if self.connection_tree.visible_items != []:
         self.connection_tree.set_size_request(
             -1,
             len(self.connection_tree.visible_items) *
             self.connection_tree.visible_items[0].get_height() + 1)
     else:
         container_remove_all(self.buttonbox)
Exemple #26
0
    def remove_socket(self, pixbuf=None):
        if pixbuf:
            self.screenshot_pixbuf = pixbuf
            self.screenshot_box.queue_draw()
        self.socket.destroy()

        container_remove_all(self)
        self.pack_start(self.screenshot_box, True, True)
        self.show_all()
Exemple #27
0
 def hierarchy_change(self, widget, previous_toplevel):
     # When detail page remove from it's container, previous_toplevel is not None.
     if previous_toplevel != None:
         container_remove_all(
             self.right_slide_box
         )  # remove slide box first, to avoid screenshot area flash
         container_remove_all(
             self.right_comment_box
         )  # remove comment box first, to avoid comment area flash
Exemple #28
0
 def on_leave_notify_event(self, widget, event):    
     if self.drag_move: return
     
     if not self.is_in_window():
         self.draw_animation = True
         container_remove_all(self.body_box)
         self.active_draw_func = self.draw_control
         self.target_draw_func = self.draw_info
         self.start_animation(self.info_box)
 def select_view_item_changed(self, widget):
     if len(self.select_view.items) == 0:
         container_remove_all(self)
         self.pack_start(self.no_favorites_align, True, True)
         self.pack_end(self.control_align, False, True)
     else:
         container_remove_all(self)
         self.pack_start(self.select_view_sw, True, True)
         self.pack_end(self.control_align, False, True)
    def update_rank_page(self, page_index):
        container_remove_all(self.page_align)
        self.current_page_index = page_index

        self.page_align.add(self.loading)

        ThreadMethod(self.get_rank_pkg_names,
                     (self.view_list[page_index][0], )).start()
        self.show_all()
Exemple #31
0
    def remove_socket(self, pixbuf=None):
        if pixbuf:
            self.screenshot_pixbuf = pixbuf
            self.screenshot_box.queue_draw()
        self.socket.destroy()

        container_remove_all(self)
        self.pack_start(self.screenshot_box, True, True)
        self.show_all()
Exemple #32
0
 def select_view_item_changed(self, widget):
     if len(self.select_view.items) == 0:
         container_remove_all(self)
         self.pack_start(self.no_favorites_align, True, True)
         self.pack_end(self.control_align, False, True)
     else:
         container_remove_all(self)
         self.pack_start(self.select_view_sw, True, True)
         self.pack_end(self.control_align, False, True)
 def update_message_bar(self, treeview):
     if len(treeview.visible_items) > 0:
         self.message_bar.set_message(_("%s: %s matched applications") % (' '.join(self.keywords), len(self.all_pkg_names)))
         container_remove_all(self)
         self.pack_start(self.content_box)
         global_event.emit("update-current-status-pkg-page", treeview)
     else:
         container_remove_all(self)
         self.pack_start(self.cute_message_image)
    def switch_to_album_summary_view(self):
        self.in_detail_view = False

        container_remove_all(self)
        container_remove_all(self.album_summary_align)
        self.album_summary_align.add(self.album_summary_view)

        self.pack_start(self.album_summary_align, True, True)

        self.album_summary_view.iconview.items[0].icon_item_button_press(0, 0)
Exemple #35
0
    def switch_to_album_summary_view(self):
        self.in_detail_view = False

        container_remove_all(self)
        container_remove_all(self.album_summary_align)
        self.album_summary_align.add(self.album_summary_view)

        self.pack_start(self.album_summary_align, True, True)

        self.show_all()
Exemple #36
0
    def switch_to_album_summary_view(self):
        self.in_detail_view = False

        container_remove_all(self)
        container_remove_all(self.album_summary_align)
        self.album_summary_align.add(self.album_summary_view)

        self.pack_start(self.album_summary_align, True, True)

        self.album_summary_view.iconview.items[0].icon_item_button_press(0, 0)
 def reload_items(self, child_items):    
     if child_items:
         container_remove_all(self.child_box)
         for index, item in enumerate(child_items):
             simple_item = SimpleItem(
                 (app_theme.get_pixbuf("filter/point_normal.png"),
                  app_theme.get_pixbuf("filter/point_press.png"),
                  item[0], item[1]),
                 index + 1, 9, 25, 15, 10, 10, self.set_index, self.get_index, ALIGN_START)
             self.child_box.pack_start(simple_item)
         self.show_all()        
Exemple #38
0
 def update_message_bar(self, treeview):
     if len(treeview.visible_items) > 0:
         self.message_bar.set_message(
                 " ".join(self.keywords) + ": " +
                 _("%s applications searched") % len(self.all_pkg_names))
         container_remove_all(self)
         self.pack_start(self.content_box)
         global_event.emit("update-current-status-pkg-page", treeview)
     else:
         container_remove_all(self)
         self.pack_start(self.cute_message_image)
Exemple #39
0
 def reload_items(self, child_items):
     if child_items:
         container_remove_all(self.child_box)
         for index, item in enumerate(child_items):
             simple_item = SimpleItem(
                 (app_theme.get_pixbuf("filter/point_normal.png"),
                  app_theme.get_pixbuf("filter/point_press.png"), item[0],
                  item[1]), index + 1, 9, 25, 15, 10, 10, self.set_index,
                 self.get_index, ALIGN_START)
             self.child_box.pack_start(simple_item)
         self.show_all()
Exemple #40
0
    def switch_to_album_detail_view(self, album_info):
        self.in_detail_view = True

        container_remove_all(self)
        container_remove_all(self.album_detail_align)
        album_detail_page = AlbumDetailPage(self.data_manager, album_info)
        self.album_detail_align.add(album_detail_page)

        self.pack_start(self.album_detail_align, True, True)

        self.show_all()
        global_event.emit("update-current-status-pkg-page", album_detail_page.treeview)
    def add_button(self, add_button):
        container_remove_all(self.buttons_align.get_children()[0])

        self.__setup_reset_button()
        button = Button(add_button)
        button.set_size_request(self.button_width, WIDGET_HEIGHT)
        button.connect("clicked", self.__add_button_clicked, add_button)
        self.buttons_list = []
        self.buttons_list.append(button)
        self.buttons_list.append(self.reset_button)
        self.buttons_align = self.__setup_buttons_align(self.buttons_list)
        self.right_box.pack_start(self.buttons_align)
    def add_button(self, add_button):
        container_remove_all(self.buttons_align.get_children()[0])

        self.__setup_reset_button()
        button = Button(add_button)
        button.set_size_request(self.button_width, WIDGET_HEIGHT)
        button.connect("clicked", self.__add_button_clicked, add_button)
        self.buttons_list = []
        self.buttons_list.append(button)
        self.buttons_list.append(self.reset_button)
        self.buttons_align = self.__setup_buttons_align(self.buttons_list)        
        self.right_box.pack_start(self.buttons_align)
 def resize_items(self, widget=None):
     if not widget: widget = self.__topbar
     container_remove_all(widget)
     total = len(self.items)
     if total > 0:
         rect = widget.allocation
         average_width = rect.width / total
         for item in self.items:
             item.press_callback = self.on_item_press
             item.set_size_request(average_width, self.default_height)
             self.__topbar.pack_start(item, False, False)
         widget.show_all()
 def resize_items(self, widget=None):        
     if not widget: widget = self.__topbar
     container_remove_all(widget)        
     total = len(self.items)
     if total > 0:
         rect = widget.allocation
         average_width = rect.width / total
         for item in self.items:
             item.press_callback = self.on_item_press
             item.set_size_request(average_width, self.default_height)
             self.__topbar.pack_start(item, False, False)
         widget.show_all()
 def on_camera_clicked_cb(self, button):
     self.current_mode = self.MODE_CAMERA_EDIT
     drawable = self.camera_area.window
     colormap = drawable.get_colormap()
     pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, *drawable.get_size())
     pixbuf = pixbuf.get_from_drawable(drawable, colormap, 0, 0, 0, 0, *drawable.get_size()) 
     self.__edit_picture(pixbuf)
     container_remove_all(self.button_hbox)
     self.button_hbox.pack_start(self.button_zoom_in_align)
     self.button_hbox.pack_start(self.button_zoom_out_align)
     self.button_hbox.pack_start(self.button_camera_again_align)
     self.button_hbox.show_all()
Exemple #46
0
    def switch_to_album_detail_view(self, album_info):
        self.in_detail_view = True

        container_remove_all(self)
        container_remove_all(self.album_detail_align)
        album_detail_page = AlbumDetailPage(self.data_manager, album_info)
        self.album_detail_align.add(album_detail_page)

        self.pack_start(self.album_detail_align, True, True)

        self.show_all()
        global_event.emit("update-current-status-pkg-page",
                          album_detail_page.treeview)
 def __init_sections(self, index):
     section_list = [WiredSection, WirelessSection, DSLSection, MobileSection, VpnSection, Proxy]
     if index == -1:
         container_remove_all(self.vbox)
         for section in section_list:
             section_ins = apply(section)
             self.vbox.pack_start(section_ins, False, True)
     else:
         for section in self.vbox.get_children():
             if section.show_or_hide():
                 section.section_show()
             else:
                 section.section_hide()
 def things_after_scanning():
     container_remove_all(self.under_camera_box)
     self.try_again_button = Button(_("Try Again"))
     self.try_again_button.set_size_request(CAMERA_BOX_SIZE, 25)
     self.try_again_button.connect("clicked", self.__start_record_clicked)
     start_record_button_align = gtk.Alignment(0.5, 0.5, 0, 0)
     start_record_button_align.add(self.try_again_button)
     if success > 0:
         facepp.train.verify(person_name=get_person_name())
         self.under_camera_box.pack_start(self.success)
     else:
         self.under_camera_box.pack_start(self.fail)
     self.under_camera_box.pack_start(start_record_button_align)
    def run(self):
        self.start_dsc_backend()
        container_remove_all(self.background)
        self.background.pack_start(self.update_info_label_align)

        gtk.timeout_add(1000, lambda:self.bus_interface.start_update_list(
                reply_handler=lambda :handle_dbus_reply("start_update_list"),
                error_handler=lambda e:handle_dbus_error("start_update_list", e)))

        self.application.run()
        self.bus_interface.request_quit(
                reply_handler=lambda :handle_dbus_reply("request_quit"), 
                error_handler=lambda e:handle_dbus_error("request_quit", e))
Exemple #50
0
    def show_screenshot(self):
        container_remove_all(self.right_slide_box)
        screenshot_dir = os.path.join(SCREENSHOT_DOWNLOAD_DIR, self.pkg_name)

        if os.path.exists(screenshot_dir):
            screenshot_files = map(
                lambda filename: os.path.join(screenshot_dir, filename),
                filter(lambda file_name: file_name.endswith(".png"),
                       os.listdir(screenshot_dir)))

            if len(screenshot_files) > 0:
                slide_switcher = SlideSwitcher(
                    map(
                        lambda screenshot_file: get_resize_pixbuf_with_height(
                            screenshot_file, 290), screenshot_files),
                    pointer_offset_x=-370,
                    pointer_offset_y=-15,
                    horizontal_align=ALIGN_MIDDLE,
                    vertical_align=ALIGN_MIDDLE,
                    height_offset=60,
                    hover_switch=False,
                    auto_switch=False,
                    navigate_switch=True,
                )
                slide_align = gtk.Alignment()
                slide_align.set(0.5, 0.5, 1, 1)
                slide_align.add(slide_switcher)
                slide_align.connect("expose-event",
                                    self.expose_resizable_label_background)
                self.right_slide_box.pack_start(slide_align, True, True)

                powered_link = Label(
                    _("Powered by UpYun.com"),
                    text_color=app_theme.get_color("homepage"),
                    hover_color=app_theme.get_color("homepage_hover"),
                )
                powered_link.set_clickable()
                powered_link.connect(
                    "button-press-event", lambda w, e: run_command(
                        "xdg-open https://www.upyun.com/"))
                powered_link_align = gtk.Alignment()
                powered_link_align.set(1.0, 0.5, 0, 0)
                powered_link_align.set_padding(0, 0, 0, 100)
                powered_link_align.add(powered_link)
                self.right_slide_box.pack_start(powered_link_align, False,
                                                False)

                self.show_all()
            else:
                global_logger.error("%s haven't any screenshot from zip file" %
                                    self.pkg_name)
Exemple #51
0
 def on_camera_clicked_cb(self, button):
     self.current_mode = self.MODE_CAMERA_EDIT
     drawable = self.camera_area.window
     colormap = drawable.get_colormap()
     pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8,
                             *drawable.get_size())
     pixbuf = pixbuf.get_from_drawable(drawable, colormap, 0, 0, 0, 0,
                                       *drawable.get_size())
     self.__edit_picture(pixbuf)
     container_remove_all(self.button_hbox)
     self.button_hbox.pack_start(self.button_zoom_in_align)
     self.button_hbox.pack_start(self.button_zoom_out_align)
     self.button_hbox.pack_start(self.button_camera_again_align)
     self.button_hbox.show_all()
    def add_listview(self, items):
        container_remove_all(self.listview_box)

        if len(items) != 0:
            self.factory = ListviewFactory(items, "detail")
            self.listview = self.factory.listview

            self.listview_box.pack_start(self.listview)
        else:
            empty_box_align = gtk.Alignment(0.5, 0.5, 0, 0)
            empty_box_align.add(Label("(Empty)"))
            self.listview_box.pack_start(empty_box_align)

        self.listview_box.show_all()
Exemple #53
0
 def things_after_scanning():
     container_remove_all(self.under_camera_box)
     self.try_again_button = Button(_("Try Again"))
     self.try_again_button.set_size_request(CAMERA_BOX_SIZE, 25)
     self.try_again_button.connect("clicked",
                                   self.__start_record_clicked)
     start_record_button_align = gtk.Alignment(0.5, 0.5, 0, 0)
     start_record_button_align.add(self.try_again_button)
     if success > 0:
         facepp.train.verify(person_name=get_person_name())
         self.under_camera_box.pack_start(self.success)
     else:
         self.under_camera_box.pack_start(self.fail)
     self.under_camera_box.pack_start(start_record_button_align)
    def update_message_bar(self, treeview):
        if self.get_installing_pkgs_number() == 0:
            if self.get_installed_pkgs_number() == 0:
                container_remove_all(self.message_box)

                children = self.content_box.get_children()
                if len(children) == 0 or children[0] == self.treeview:
                    if self.cute_message_pixbuf == None:
                        self.cute_message_pixbuf = utils.get_common_locale_image_pixbuf(
                            "info", "no_download.png")

                    container_remove_all(self.content_box)
                    self.content_box.pack_start(self.cute_message_image, True,
                                                True)

                    self.show_all()
            else:
                self.message_bar.set_message("")
        else:
            container_remove_all(self.message_box)
            self.message_box.pack_start(self.message_bar, True, True)
            self.message_bar.set_message(
                _("%s applications are being installed") %
                self.get_installing_pkgs_number())

            children = self.content_box.get_children()
            if len(children) == 0 or children[0] == self.cute_message_image:
                if self.cute_message_pixbuf:
                    del self.cute_message_pixbuf
                    self.cute_message_pixbuf = None

                container_remove_all(self.content_box)
                self.content_box.pack_start(self.treeview, True, True)

                self.show_all()
    def update_message_bar(self, treeview):
        if self.get_installing_pkgs_number() == 0:
            if self.get_installed_pkgs_number() == 0:
                container_remove_all(self.message_box)

                children = self.content_box.get_children()
                if len(children) == 0 or children[0] == self.treeview:
                    if self.cute_message_pixbuf == None:
                        self.cute_message_pixbuf = utils.get_common_locale_image_pixbuf("info", "no_download.png")

                    container_remove_all(self.content_box)
                    self.content_box.pack_start(self.cute_message_image, True, True)

                    self.show_all()
            else:
                self.message_bar.set_message("")
        else:
            container_remove_all(self.message_box)
            self.message_box.pack_start(self.message_bar, True, True)
            self.message_bar.set_message(_("%s applications are being installed") % self.get_installing_pkgs_number())

            children = self.content_box.get_children()
            if len(children) == 0 or children[0] == self.cute_message_image:
                if self.cute_message_pixbuf:
                    del self.cute_message_pixbuf
                    self.cute_message_pixbuf = None

                container_remove_all(self.content_box)
                self.content_box.pack_start(self.treeview, True, True)

                self.show_all()
    def switch_page(self, page_index):
        container_remove_all(self.page_box)
        page_name = self.page_name[page_index]

        if not self.page_cache.has_key(self.page_name[page_index]):
            self.page_cache[page_name] = getattr(self, self.tab_switcher_pages_callback[page_index])()

        self.active_page = self.page_cache[page_name]
        self.page_box.pack_start(self.active_page, True, True)
        
        if isinstance(self.active_page, AlbumPage):
            if self.active_page.in_detail_view:
                self.active_page.switch_to_album_summary_view()

        self.recommend_scrolled_window.show_all()
 def __init_sections(self, index):
     section_list = [
         WiredSection, WirelessSection, DSLSection, MobileSection,
         VpnSection, Proxy
     ]
     if index == -1:
         container_remove_all(self.vbox)
         for section in section_list:
             section_ins = apply(section)
             self.vbox.pack_start(section_ins, False, True)
     else:
         for section in self.vbox.get_children():
             if section.show_or_hide():
                 section.section_show()
             else:
                 section.section_hide()
Exemple #58
0
    def switch_page(self, page_index):
        container_remove_all(self.page_box)
        page_name = self.page_name[page_index]

        if not self.page_cache.has_key(self.page_name[page_index]):
            self.page_cache[page_name] = getattr(
                self, self.tab_switcher_pages_callback[page_index])()

        self.active_page = self.page_cache[page_name]
        self.page_box.pack_start(self.active_page, True, True)

        #if isinstance(self.active_page, AlbumPage):
        #if self.active_page.in_detail_view:
        #self.active_page.switch_to_album_summary_view()

        self.recommend_scrolled_window.show_all()
    def init_ui(self):

        self.service_type = self.vpn_setting.service_type.split(".")[-1]

        def table_attach(widget_name, row, padding=0):
            label = getattr(self, widget_name + "_label_align")
            widget = getattr(self, widget_name + "_align")
            self.method_table.attach(label, 0, 2, row, row + 1)
            self.method_table.attach(widget,
                                     2,
                                     3,
                                     row,
                                     row + 1,
                                     xpadding=padding)

        #print self.service_type
        container_remove_all(self.method_table)
        self.method_table.attach(self.method_title, 0, 3, 0, 1)
        table_attach("refuse_eap", 1)
        table_attach("refuse_pap", 2)
        table_attach("refuse_chap", 3)
        table_attach("refuse_mschap", 4)
        table_attach("refuse_mschapv2", 5)
        self.method_table.attach(self.compression_title, 0, 3, 6, 7)
        table_attach("require_mppe", 8)
        if self.require_mppe.get_active():
            table_attach("require_mppe_128", 9)
            table_attach("mppe_stateful", 10)
        table_attach("nobsdcomp", 11)
        table_attach("nodeflate", 12)
        table_attach("no_vj_comp", 13)
        self.method_table.attach(self.echo_title, 0, 3, 16, 17)
        table_attach("ppp_echo", 18)

        if self.service_type == "l2tp":
            #print "this is l2tp"
            table_attach("nopcomp", 14)
            table_attach("noaccomp", 15)

            self.method_table.attach(self.ipsec_title, 0, 3, 19, 20)
            table_attach("ip_sec_enable", 20)
            if self.ip_sec_enable.get_active():
                table_attach("group_name", 21)
                table_attach("gateway_id", 22)
                table_attach("pre_shared_key", 23)

        self.method_table.show_all()