def __init__(self):
     
     # Init theme datas.
     self.__init_data()
     argv = ""
     for theme in theme_manager.get_user_themes() + theme_manager.get_system_themes():
         argv += theme.get_name() + ";"
     self.module_frame = ModuleFrame(self.config_file, argv)
     
     # Init slider.
     self.slider = HSlider()
 
     self.all_page = MainBox()
 
     # Add widgets in slider.
     self.all_page.set_size_request(PAGE_WIDTH, PAGE_HEIGHT)
     
     # Connect events.
     event_manager.add_callback("add-local-wallpapers", self.add_local_wallpappers)
     
     # Connect widgets.
     self.module_frame.add(self.slider)
     self.module_frame.connect("realize", lambda w: self.slider.set_to_page(self.all_page))
     self.module_frame.module_message_handler = self.message_handler
     self.module_frame.run()        
Ejemplo n.º 2
0
        
        This is IconView interface, you should implement it.
        '''
        pass

    def icon_item_release_resource(self):
        # Return True to tell IconView call gc.collect() to release memory resource.
        if self.pixbuf:
            del self.pixbuf
        self.pixbuf = None
        return True


if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(
        os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    scrolled_window = ScrolledWindow()
    scrolled_window.set_size_request(788, 467)
    wallpaper_view = WallpaperView()
    scrolled_window.add_child(wallpaper_view)
    module_frame.add(scrolled_window)

    scrolled_window.connect("vscrollbar-state-changed",
                            wallpaper_view.load_more_background)

    download_pool = MissionThreadPool(5)
    download_pool.start()

    def message_handler(*message):
        (message_type, message_content) = message
class DeepinIndividuation(object):
    
    config_file = os.path.join(get_parent_dir(__file__, 2), "config.ini")
    
    def __init__(self):
        
        # Init theme datas.
        self.__init_data()
        argv = ""
        for theme in theme_manager.get_user_themes() + theme_manager.get_system_themes():
            argv += theme.get_name() + ";"
        self.module_frame = ModuleFrame(self.config_file, argv)
        
        # Init slider.
        self.slider = HSlider()
    
        self.all_page = MainBox()
    
        # Add widgets in slider.
        self.all_page.set_size_request(PAGE_WIDTH, PAGE_HEIGHT)
        
        # Connect events.
        event_manager.add_callback("add-local-wallpapers", self.add_local_wallpappers)
        
        # Connect widgets.
        self.module_frame.add(self.slider)
        self.module_frame.connect("realize", lambda w: self.slider.set_to_page(self.all_page))
        self.module_frame.module_message_handler = self.message_handler
        self.module_frame.run()        

    def add_local_wallpappers(self, name, obj, theme):
        d = gtk.FileChooserDialog(
                "Choose Pictures",
                None,
                gtk.FILE_CHOOSER_ACTION_OPEN,
                (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                 gtk.STOCK_OPEN, gtk.RESPONSE_ACCEPT)
                )
        d.set_select_multiple(True)
        d.set_current_folder(get_images_dir())
        pic_filter = gtk.FileFilter()
        pic_filter.set_name(_("Image files"))
        pic_filter.add_mime_type("image/*")
        d.add_filter(pic_filter)
        response = d.run()
        if(response == gtk.RESPONSE_ACCEPT):
            filenames = d.get_filenames()
            wallpapper_path = get_download_wallpaper_dir()
            for name in filenames:
                shutil.copy2(name, wallpapper_path)
        d.destroy()

    def __init_data(self):
        theme_manager.load()
        theme_manager.untitled_theme(theme_manager.get_default_theme())
    
    def message_handler(self, *message):
        (message_type, message_content) = message
        if message_type == "click_crumb":
            (crumb_index, crumb_label) = message_content
                
        elif message_type == "show_again":
            self.module_frame.send_module_info()

        elif message_type == "switch-theme":
            theme = None

            for item in theme_manager.get_user_themes() + theme_manager.get_system_themes():
                if item.get_name() == message_content:
                    theme = item
                    break

            if theme:
                print "DEBUG", theme
                event_manager.emit("theme-detail", theme)

        elif message_type == "exit":
            self.module_frame.exit()
Ejemplo n.º 4
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
from deepin_utils.file import get_parent_dir

sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from app_asso_view import AppMain
from module_frame import ModuleFrame

if __name__ == "__main__":
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    app_asso_view = AppMain()

    module_frame.add(app_asso_view)

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()

    module_frame.module_message_handler = message_handler

    module_frame.run()
            input_list.append(TreeItem(self.image_widgets["device"], description, sources[idx]['name'], idx))
            i += 1
        self.view_widgets["ad_input"].add_items(input_list, clear_first=True)
        if not (selected_row < 0):
            self.view_widgets["ad_input"].set_select_rows([selected_row])

    def set_status_text(self, text):
        self.container_widgets["statusbar"].set_text(text)

    def set_to_default(self):
        '''set to the default'''
        pass

if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    sound_settings = SoundSetting(module_frame)

    #module_frame.add(sound_settings.alignment_widgets["slider"])
    module_frame.add(sound_settings.container_widgets["main_vbox"])
    module_frame.connect("realize", lambda w: sound_settings.container_widgets["slider"].set_to_page(gtk.VBox()))
    if len(sys.argv) > 1:
        print "module_uid:", sys.argv[1]

    def message_handler(*message):
        (message_type, message_content) = message
        print "message:", message_type, message_content
        if message_type == "click_crumb":
            (crumb_index, crumb_label) = message_content
            if crumb_index == 1:
                     padding_right=0,
                     width=-1,
                     height=CONTAINNER_HEIGHT):
        align = gtk.Alignment()
        align.set_size_request(width, height)
        align.set(xalign, yalign, xscale, yscale)
        align.set_padding(padding_top, padding_bottom, padding_left,
                          padding_right)
        if widget:
            align.add(widget)
        return align


if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(
        os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    sys_info = SysInfo(module_frame)

    module_frame.add(sys_info.alignment_widgets["main_hbox"])

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()
        elif message_type == "exit":
            module_frame.exit()

    module_frame.module_message_handler = message_handler
    module_frame.run()
Ejemplo n.º 7
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
from deepin_utils.file import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from bluetooth_view import BlueToothView
from module_frame import ModuleFrame

if __name__ == "__main__":
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    bluetooth_view = BlueToothView(module_frame)

    module_frame.add(bluetooth_view)

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()
        elif message_type == "cancel":
            bluetooth_view.cancel()
        elif message_type == "exit":
            module_frame.exit()
        else:
            pass
Ejemplo n.º 8
0
    
    def __setup_separator(self):
        return self.__make_align(self.__make_separator(), xalign=0.0, xscale=0.0,
                                 padding_top=10,# padding_bottom=10,
                                 padding_left=TEXT_WINDOW_LEFT_PADDING, height=-1)

    def set_status_text(self, text):
        self.container_widgets["statusbar"].set_text(text)

    def set_to_default(self, button):
        '''set to the default'''
        settings.touchpad_set_to_default()
        self.set_status_text(_("Reset to defaults"))
    
if __name__ == '__main__':
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    mouse_settings = TouchpadSetting(module_frame)
    
    module_frame.add(mouse_settings.container_widgets["main_vbox"])
    
    if len(sys.argv) > 1:
        print "module_uid:", sys.argv[1]
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            print "DEBUG show_again module_uid", message_content
            module_frame.send_module_info()
        if message_type == "reset":
            mouse_settings.set_to_default()
Ejemplo n.º 9
0
import os
import getopt
from deepin_utils.file import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from power_view import PowerView
from module_frame import ModuleFrame

if __name__ == "__main__":
    ops, args = getopt.getopt(sys.argv[1:], '')
    module_uid = None

    if len(args):
        module_uid = args[0]
    
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    power_view = PowerView()
    
    module_frame.add(power_view)
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            power_view.show_again()
            module_frame.send_module_info()
        elif message_type == "reset":
            power_view.reset()
        elif message_type == "exit":
            module_frame.exit()
Ejemplo n.º 10
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
from deepin_utils.file import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from date_time_view import DatetimeView
from module_frame import ModuleFrame

if __name__ == "__main__":
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    date_time_view = DatetimeView()
    
    module_frame.add(date_time_view)
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            date_time_view.show_again()
            module_frame.send_module_info()
        elif message_type == "reset":
            date_time_view.reset()
        elif message_type == "exit":
            module_frame.exit()
Ejemplo n.º 11
0
import os
import getopt
from deepin_utils.file import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from desktop_view import DesktopView
from module_frame import ModuleFrame

if __name__ == "__main__":
    ops, args = getopt.getopt(sys.argv[1:], '')
    module_uid = None

    if len(args):
        module_uid = args[0]

    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    desktop_view = DesktopView()

    module_frame.add(desktop_view)

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()
        elif message_type == "reset":
            desktop_view.reset()
        elif message_type == "exit":
            module_frame.exit()

    module_frame.module_message_handler = message_handler
Ejemplo n.º 12
0
        Handle double click event.
        
        This is IconView interface, you should implement it.
        '''
        pass
    
    def icon_item_release_resource(self):
        # Return True to tell IconView call gc.collect() to release memory resource.
        if self.pixbuf:
            del self.pixbuf
        self.pixbuf = None    
        return True
    
if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    scrolled_window = ScrolledWindow()
    scrolled_window.set_size_request(788, 467)
    wallpaper_view = WallpaperView()
    scrolled_window.add_child(wallpaper_view)
    module_frame.add(scrolled_window)
    
    scrolled_window.connect("vscrollbar-state-changed", wallpaper_view.load_more_background)
    
    download_pool = MissionThreadPool(5)
    download_pool.start()
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
Ejemplo n.º 13
0
            xscale=0.0,
            padding_top=10,  # padding_bottom=10,
            padding_left=TEXT_WINDOW_LEFT_PADDING,
            height=-1)

    def set_status_text(self, text):
        self.container_widgets["statusbar"].set_text(text)

    def set_to_default(self, button):
        '''set to the default'''
        settings.touchpad_set_to_default()
        self.set_status_text(_("Reset to defaults"))


if __name__ == '__main__':
    module_frame = ModuleFrame(
        os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    mouse_settings = TouchpadSetting(module_frame)

    module_frame.add(mouse_settings.container_widgets["main_vbox"])

    if len(sys.argv) > 1:
        print "module_uid:", sys.argv[1]

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            print "DEBUG show_again module_uid", message_content
            module_frame.send_module_info()
        if message_type == "reset":
            mouse_settings.set_to_default()
Ejemplo n.º 14
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
from dtk.ui.utils import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from a11y_view import A11yView
from module_frame import ModuleFrame

if __name__ == "__main__":
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    a11y_view = A11yView()
    
    module_frame.add(a11y_view)
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()

    module_frame.module_message_handler = message_handler        
    
    module_frame.run()
Ejemplo n.º 15
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
from deepin_utils.file import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from display_view import DisplayView
from module_frame import ModuleFrame

if __name__ == "__main__":
    module_frame = ModuleFrame(
        os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    display_view = DisplayView()

    module_frame.add(display_view)

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            display_view.show_again()
            module_frame.send_module_info()
        elif message_type == "reset":
            display_view.reset()
        elif message_type == "exit":
            module_frame.exit()
        elif message_type == "size_changed":
Ejemplo n.º 16
0
from module_frame import ModuleFrame 
from helper import Dispatcher

from nm_modules import nm_module
from main_ui import Network
from nls import _
from dss_log import log

slider = nm_module.slider

def start_ui(network):
    print "start ui"
    network.refresh()

if __name__ == '__main__':
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))
    Dispatcher.load_module_frame(module_frame)
    Dispatcher.load_slider(slider)

    module_frame.add(slider)

    if is_dbus_name_exists("org.freedesktop.NetworkManager", False):
        n = Network()
        Dispatcher.connect("service-start-do-more", lambda w: start_ui(n))
        
        def message_handler(*message):
            (message_type, message_content) = message
            if message_type == "show_again":
                slider._set_to_page("main")
                module_frame.send_module_info()
            elif message_type == "click_crumb":
Ejemplo n.º 17
0
        cr.rectangle(x, y, w, h)
        cr.fill()
    
    def __make_align(self, widget=None, xalign=0.0, yalign=0.5, xscale=1.0,
                     yscale=0.0, padding_top=0, padding_bottom=0, padding_left=0,
                     padding_right=0, width=-1, height=CONTAINNER_HEIGHT):
        align = gtk.Alignment()
        align.set_size_request(width, height)
        align.set(xalign, yalign, xscale, yscale)
        align.set_padding(padding_top, padding_bottom, padding_left, padding_right)
        if widget:
            align.add(widget)
        return align
if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    sys_info = SysInfo(module_frame)
    
    module_frame.add(sys_info.alignment_widgets["main_hbox"])
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()
        elif message_type == "exit":
            module_frame.exit()

    module_frame.module_message_handler = message_handler        
    module_frame.run()
Ejemplo n.º 18
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
from deepin_utils.file import get_parent_dir
sys.path.append(os.path.join(get_parent_dir(__file__, 4), "dss"))

from display_view import DisplayView
from module_frame import ModuleFrame

if __name__ == "__main__":
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    display_view = DisplayView()
    
    module_frame.add(display_view)
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            display_view.show_again()
            module_frame.send_module_info()
        elif message_type == "reset":
            display_view.reset()
        elif message_type == "exit":
            module_frame.exit()
        elif message_type == "size_changed":