def __init__(self):
        self.power_settings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.power")
        self.lockdown_settings = deepin_gsettings.new("org.gnome.desktop.screensaver")
        self.session_settings = deepin_gsettings.new("org.gnome.desktop.session")
        self.__powers_xml_filename = os.path.expanduser('~/.config/powers.xml')

        self.powers_plan = []

        self.init_xml()
Beispiel #2
0
    def __init__(self):
        self.power_settings = deepin_gsettings.new(
            "org.gnome.settings-daemon.plugins.power")
        self.lockdown_settings = deepin_gsettings.new(
            "org.gnome.desktop.screensaver")
        self.session_settings = deepin_gsettings.new(
            "org.gnome.desktop.session")
        self.__powers_xml_filename = os.path.expanduser('~/.config/powers.xml')

        self.powers_plan = []

        self.init_xml()
    def __init__(self):
        """
        init docs
        """
        gtk.VBox.__init__(self)

        self.__background_settings = deepin_gsettings.new("com.deepin.dde.background")

        self.draw_title_background = self.draw_tab_title_background
        self.theme = None

        self.wallpaper_box = gtk.VBox()
        self.window_theme_box = gtk.VBox()
        self.wallpaper_view = WallpaperView(padding_x=30, padding_y=ITEM_PADDING_Y)
        self.wallpaper_view_sw = self.wallpaper_view.get_scrolled_window()
        self.wallpaper_view_sw.set_size_request(-1, 426)

        position_group, self.position_combobox = get_combo_group(
            _("Position"), DRAW_COMBO_ITEM, self.on_position_combox_selected
        )
        time_group, self.time_combobox = get_combo_group(_("Duration"), TIME_COMBO_ITEM, self.on_time_combox_selected)

        self.__is_random = True
        if self.__background_settings.get_int("background-duration") == 0:
            self.__is_random = False
        self.unorder_play, self.random_toggle = get_toggle_group(
            _("Random"), self.__on_random_toggled, self.__is_random
        )
        self.button_align = gtk.Alignment()
        self.button_box = gtk.HBox(spacing=5)
        self.select_all_button = Button(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
        self.select_all_button.connect("clicked", self.__on_select_all)
        self.delete_button = Button(_("Delete"))
        self.delete_button.set_size_request(80, WIDGET_HEIGHT)
        self.delete_button.connect("clicked", self.__on_delete)
        self.button_box.pack_start(self.select_all_button, False, False)
        self.button_box.pack_start(self.delete_button, False, False)
        self.button_align.add(self.button_box)

        self.action_bar = gtk.HBox(spacing=26)
        self.action_bar.pack_start(position_group, False, False)
        self.action_bar.pack_start(time_group, False, False)
        self.action_bar.pack_start(self.unorder_play, False, False)
        self.action_bar.pack_end(self.button_align, False, False)
        action_bar_align = gtk.Alignment()
        action_bar_align.set_size_request(-1, STATUS_HEIGHT)
        action_bar_align.set_padding(5, 5, 50, 20)
        action_bar_align.add(self.action_bar)

        self.wallpaper_box.pack_start(self.wallpaper_view_sw, True, True)
        self.wallpaper_box.pack_start(action_bar_align, False, False)

        self.pack_start(self.wallpaper_box, False, False)

        event_manager.add_callback("select-wallpaper", self.on_wallpaper_select)
        event_manager.add_callback("apply-wallpaper", self.__on_wallpaper_apply)
        event_manager.add_callback("add-wallpapers", self.__on_add_wallpapers)
    def __init__(self):
        self.__deepin_xrandr = deepin_xrandr.new()
        self.__xrandr_settings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.xrandr")
        self.__power_settings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.power")
        self.__session_settings = deepin_gsettings.new("org.gnome.desktop.session")
        self.__screensaver_settings = deepin_gsettings.new("org.gnome.desktop.screensaver")

        self.__output_count = 0

        self.__monitors_xml_filename = "%s/.config/monitors.xml" % os.path.expanduser('~')
        if not os.path.exists(self.__monitors_xml_filename):
            self.__create_monitors_xml()

        self.__xmldoc = minidom.parse(self.__monitors_xml_filename) 
        self.__primary_output_name = None
        self.__output_names = []
        self.__output_info_by_xml = []

        self.init_xml()
Beispiel #5
0
 def __init__(self):
     super(TrayPower, self).__init__()
     self.power_set = deepin_gsettings.new(POWER_SETTING_GSET)
     self.gui = PowerGui(self.power_set)
     self.gui.click_btn.connect("clicked", self.click_btn_clicked_event)
     try:
         self.__init_dbus_inter()
     except Exception, e:
         print "traypower[error]:", e
         self.power_inter = None
         self.power_proper = None
 def __init__(self):
     gobject.GObject.__init__(self)
     self.__timer = Timer(1)
     self.__tray_time_hour_type = TRAY_TIME_12_HOUR
     self.__timer.connect("Tick", self.__update_time)
     # setting 12/24 hour.    
     if deepin_gsettings_bool:
         self.set_date = deepin_gsettings.new("com.deepin.dde.datetime")
         self.set_date.connect("changed", self.set_date_changed)
         self.set_deepin_dde_datetime()
     # start time.
     self.__timer.Enabled  = True 
 def __init__(self):
     gobject.GObject.__init__(self)
     self.__timer = Timer(5000)
     self.__tray_time_hour_type = TRAY_TIME_12_HOUR
     self.__timer.connect("Tick", self.__update_time)
     # setting 12/24 hour.
     if deepin_gsettings_bool:
         self.set_date = deepin_gsettings.new("com.deepin.dde.datetime")
         self.set_date.connect("changed", self.set_date_changed)
         self.set_deepin_dde_datetime()
     # start time.
     self.__timer.Enabled = True
Beispiel #8
0
    def __init__(self):
        self.__xrandr_gsettings = deepin_gsettings.new(
            "org.gnome.settings-daemon.plugins.xrandr")
        new_brightness = self.__xrandr_gsettings.get_double("brightness")
        if new_brightness > 0.1:
            self.__xrandr_gsettings.set_double("brightness", new_brightness)

        self.gui = Gui()
        self.dbus_user = User(DBUS_USER_STR)
        self.dialog = TrayDialog()

        self.resource_dict = {
            "deepin_shutdown": {
                "info_text": SHUTDOWN_TEXT,
                "ok_text": _("Shut down"),
                "force_ok_text": _("Force shut down"),
                "ok_exec": self.gui.cmd_dbus.new_stop,
            },
            "deepin_restart": {
                "info_text": RESTART_TEXT,
                "ok_text": _("Restart"),
                "force_ok_text": _("Force restart"),
                "ok_exec": self.gui.cmd_dbus.new_restart,
            },
            "deepin_suspend": {
                "info_text": SUSPEND_TEXT,
                "ok_text": _("Suspend"),
                "force_ok_text": _("Force suspend"),
                "ok_exec": self.gui.cmd_dbus.suspend,
            },
            "deepin_hibernate": {
                "info_text": LOGOUT_TEXT,
                "ok_text": _("Log out"),
                "force_ok_text": _("Force log out"),
                "ok_exec": lambda: self.gui.cmd_dbus.logout(1),
            },
        }

        self.gui.stop_btn.connect("clicked", self.check_system_app_running,
                                  'deepin_shutdown')
        self.gui.restart_btn.connect("clicked", self.check_system_app_running,
                                     'deepin_restart')
        self.gui.suspend_btn.connect("clicked", self.check_system_app_running,
                                     'deepin_suspend')
        self.gui.logout_btn.connect("clicked", self.check_system_app_running,
                                    'deepin_hibernate')
        self.gui.switch_btn.connect("clicked", self.switch_btn_clicked)
        self.gui.lock_btn.connect("clicked", self.lock_btn_clicked)
        self.gui.user_label_event.connect("button-press-event",
                                          self.user_label_clicked)
    def __init__(self):
        self.__xrandr_gsettings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.xrandr")
        new_brightness = self.__xrandr_gsettings.get_double("brightness")
        if new_brightness > 0.1:
            self.__xrandr_gsettings.set_double("brightness", new_brightness)
        
        self.gui = Gui()
        self.dbus_user = User(DBUS_USER_STR)
        self.dialog = TrayDialog()

        self.resource_dict = {
                "deepin_shutdown": {
                    "info_text": SHUTDOWN_TEXT,
                    "ok_text": _("Shut down"),
                    "force_ok_text": _("Force shut down"),
                    "ok_exec": self.gui.cmd_dbus.new_stop,
                    },
                "deepin_restart": {
                    "info_text": RESTART_TEXT,
                    "ok_text": _("Restart"),
                    "force_ok_text": _("Force restart"),
                    "ok_exec": self.gui.cmd_dbus.new_restart,
                    },
                "deepin_suspend": {
                    "info_text": SUSPEND_TEXT,
                    "ok_text": _("Suspend"),
                    "force_ok_text": _("Force suspend"),
                    "ok_exec": self.gui.cmd_dbus.suspend,
                    },
                "deepin_hibernate": {
                    "info_text": LOGOUT_TEXT,
                    "ok_text": _("Log out"),
                    "force_ok_text": _("Force log out"),
                    "ok_exec": lambda:self.gui.cmd_dbus.logout(1),
                    },
                }

        self.gui.stop_btn.connect("clicked", self.check_system_app_running, 'deepin_shutdown')
        self.gui.restart_btn.connect("clicked", self.check_system_app_running, 'deepin_restart')
        self.gui.suspend_btn.connect("clicked", self.check_system_app_running, 'deepin_suspend')
        self.gui.logout_btn.connect("clicked", self.check_system_app_running, 'deepin_hibernate')
        self.gui.switch_btn.connect("clicked", self.switch_btn_clicked)
        self.gui.lock_btn.connect("clicked", self.lock_btn_clicked)
        self.gui.user_label_event.connect("button-press-event", self.user_label_clicked)
    def __init__(self):
        self.media_autorun_settings = deepin_gsettings.new("org.gnome.desktop.media-handling")

        self.cd_content_type = "x-content/audio-cdda"
        self.dvd_content_type = "x-content/video-dvd"
        self.player_content_type = "x-content/audio-player"
        self.photo_content_type = "x-content/image-dcf"
        self.software_content_type = "x-content/unix-software"

        ###other content types
        self.audio_dvd_content_type = "x-content/audio-dvd"
        self.blank_bd_content_type = "x-content/blank-bd"
        self.blank_cd_content_type = "x-content/blank-dvd"
        self.blank_hddvd_content_type = "x-content/blank-hddvd"
        self.video_bluray_content_type = "x-content/video-bluray"
        self.ebook_reader_content_type = "x-content/ebook-reader"
        self.video_hddvd_content_type = "x-content/video-hddvd"
        self.image_picturecd_content_type = "x-content/image-picturecd"
        self.video_svcd_content_type = "x-content/video-svcd"
        self.video_vcd_content_type = "x-content/video-vcd"

        '''
Beispiel #11
0
    def __init__(self):
        self.media_autorun_settings = deepin_gsettings.new(
            "org.gnome.desktop.media-handling")

        self.cd_content_type = "x-content/audio-cdda"
        self.dvd_content_type = "x-content/video-dvd"
        self.player_content_type = "x-content/audio-player"
        self.photo_content_type = "x-content/image-dcf"
        self.software_content_type = "x-content/unix-software"

        ###other content types
        self.audio_dvd_content_type = "x-content/audio-dvd"
        self.blank_bd_content_type = "x-content/blank-bd"
        self.blank_cd_content_type = "x-content/blank-dvd"
        self.blank_hddvd_content_type = "x-content/blank-hddvd"
        self.video_bluray_content_type = "x-content/video-bluray"
        self.ebook_reader_content_type = "x-content/ebook-reader"
        self.video_hddvd_content_type = "x-content/video-hddvd"
        self.image_picturecd_content_type = "x-content/image-picturecd"
        self.video_svcd_content_type = "x-content/video-svcd"
        self.video_vcd_content_type = "x-content/video-vcd"
        '''
    def __init__(self):
        '''
        init docs
        '''
        gtk.HBox.__init__(self)

        self.__toggle_id = None
        self.__time_id = None

        self.datetime_settings = deepin_gsettings.new("com.deepin.dde.datetime")

        self.__deepin_dt = DeepinDateTime()
        self.current_tz_gmtoff = self.__deepin_dt.get_gmtoff()

        self.timezone_items = []
        self.timezone_items.append((_("(UTC-11:00)Samoa"), -11))
        self.timezone_items.append((_("(UTC-10:00)Hawaii"), -10))
        self.timezone_items.append((_("(UTC-09:00)Alaska"), -9))
        self.timezone_items.append((_("(UTC-08:00)Lower California"), -8))
        self.timezone_items.append((_("(UTC-07:00)Arizona, Llamas, Mazatlan, Chihuahua"), -7))
        self.timezone_items.append((_("(UTC-06:00)Saskatchewan, Mexico City, Monterrey"), -6))
        self.timezone_items.append((_("(UTC-05:00)Indiana, Bogota, Lima, Quito"), -5))
        self.timezone_items.append((_("(UTC-04:00)San Diego, Georgetown, San Juan"), -4))
        self.timezone_items.append((_("(UTC-03:00)Greenland, Brasilia, Fortaleza"), -3))
        self.timezone_items.append((_("(UTC-02:00)Mid-Atlantic"), -2))
        self.timezone_items.append((_("(UTC-01:00)Cape Verde Islands, Azores"), -1))
        self.timezone_items.append((_("(UTC)London, Dublin, Edinburgh, Lisbon, Casablanca"), 0))
        self.timezone_items.append((_("(UTC+01:00)Paris, Amsterdam, Berlin, Rome, Vienna"), 1))
        self.timezone_items.append((_("(UTC+02:00)Cairo, Athens, Istanbul, Jerusalem"), 2))
        self.timezone_items.append((_("(UTC+03:00)Moscow, St. Petersburg, Baghdad"), 3))
        self.timezone_items.append((_("(UTC+04:00)Port Louis, Abu Dhabi, Muscat, Yerevan"), 4))
        self.timezone_items.append((_("(UTC+05:00)Islamabad, Karachi, Tashkent"), 5))
        self.timezone_items.append((_("(UTC+06:00)Dhaka, Novosibirsk"), 6))
        self.timezone_items.append((_("(UTC+07:00)Bangkok, Hanoi, Jakarta"), 7))
        self.timezone_items.append((_("(UTC+08:00)Beijing, Chongqing, HongKong, Taipei, Urumqi"), 8))
        self.timezone_items.append((_("(UTC+09:00)Osaka, Sapporo, Tokyo, Seoul"), 9))
        self.timezone_items.append((_("(UTC+10:00)Guam, Canberra, Melbourne, Sydney"), 10))
        self.timezone_items.append((_("(UTC+11:00)Magadan, Solomon Islands"), 11))
        self.timezone_items.append((_("(UTC+12:00)New Zealand, Kiribati"), 12))
        self.is_24hour = self.datetime_settings.get_boolean("is-24hour")
        '''
        left align
        '''
        self.left_align = self.__setup_align(
            padding_top = TEXT_WINDOW_TOP_PADDING, 
            padding_left = TEXT_WINDOW_LEFT_PADDING)
        '''
        left box
        '''
        self.left_box = gtk.VBox()
        '''
        calendar title
        '''
        self.calendar_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/calendar.png"), _("Calendar"))
        '''
        current date
        '''
        self.cur_date_align = self.__setup_align()
        self.cur_date_label = self.__setup_label(
            _("Current Date: %d-%d-%d") % (time.localtime().tm_year, 
                                           time.localtime().tm_mon, 
                                           time.localtime().tm_mday), 
            190)
        self.cur_date_align.add(self.cur_date_label)
        '''
        calendar widget
        '''
        self.calendar_align = self.__setup_align(padding_top = BETWEEN_SPACING, 
            padding_bottom = 10)
        self.calendar = deepin_lunar.new()
        if MAIN_LANG == "en_US":
            self.calendar = dltk_calendar.new()
        self.calendar.mark_day(time.localtime().tm_mday)
        self.calendar.get_handle().set_size_request(300, 280)
        self.calendar.get_handle().connect("day-selected", self.__on_day_selected, self.calendar)
        self.calendar_align.add(self.calendar.get_handle())
        self.change_date_box = gtk.HBox(spacing = 5)
        self.change_date_box.set_size_request(300, -1)
        self.change_date_align = self.__setup_align()
        self.change_date_button = Button(_("Change Date"))
        self.change_date_button.connect("button-press-event", self.__on_change_date)
        self.change_date_align.add(self.change_date_button)
        self.edit_date_align = self.__setup_align()
        self.edit_date_box = gtk.HBox(spacing = 5)
        self.cancel_date_button = Button(_("Cancel"))
        self.cancel_date_button.connect("button-press-event", self.__on_cancel_change_date)
        self.confirm_date_button = Button(_("Confirm"))
        self.confirm_date_button.connect("button-press-event", self.__on_confirm_change_date)
        self.__widget_pack_start(self.edit_date_box, 
            [self.cancel_date_button, self.confirm_date_button])
        self.edit_date_align.add(self.edit_date_box)

        self.change_date_box.pack_end(self.change_date_align, False, False)
        '''
        left box && align
        '''
        self.__widget_pack_start(self.left_box, 
            [self.calendar_title_align, 
             self.cur_date_align, 
             self.calendar_align, 
             self.change_date_box])
        self.left_align.add(self.left_box)
        '''
        right align
        '''
        self.right_align = self.__setup_align(
            padding_top = TEXT_WINDOW_TOP_PADDING, padding_left = TEXT_WINDOW_LEFT_PADDING)
        '''
        right box
        '''
        self.right_box = gtk.VBox()
        '''
        time title
        '''
        self.time_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/time.png"), _("Time"))
        '''
        current time
        '''
        self.cur_time_align = self.__setup_align()
        if self.is_24hour:
            self.cur_time_label = self.__setup_label(
                _("Current Time: %s %02d:%02d:%02d (%d Hour)") % 
                  (time.strftime('%p'), 
                   time.localtime().tm_hour, 
                   time.localtime().tm_min, 
                   time.localtime().tm_sec, 
                   24), 
                260)
        else:
            self.cur_time_label = self.__setup_label(                           
                _("Current Time: %s %02d:%02d:%02d (%d Hour)") %                
                  (time.strftime('%p'),                                         
                   time.localtime().tm_hour,                                    
                   time.localtime().tm_min,                                     
                   time.localtime().tm_sec,                                     
                   12),                                                         
                260)     

        self.cur_time_align.add(self.cur_time_label)
        '''
        DateTime widget
        '''
        self.datetime_widget_align = self.__setup_align(padding_top = BETWEEN_SPACING)
        self.datetime_widget = DateTimeHTCStyle(is_24hour = self.is_24hour)
        self.datetime_widget_align.add(self.datetime_widget)
        self.set_time_align = self.__setup_align()
        '''
        auto time get && set
        '''
        self.auto_time_align = self.__setup_align(padding_top = TEXT_WINDOW_TOP_PADDING)
        self.auto_time_box = gtk.HBox(spacing = BETWEEN_SPACING)
        self.auto_time_label = self.__setup_label(_("NTP"))
        self.auto_time_toggle = self.__setup_toggle()
        is_auto_set_time = self.datetime_settings.get_boolean("is-auto-set")
        if is_auto_set_time:
            #AutoSetTimeThread(self).start()
            self.__deepin_dt.set_using_ntp(True)
        else:
            self.__deepin_dt.set_using_ntp(False)
        self.auto_time_toggle_align = self.__setup_align(padding_top = 4)
        self.auto_time_toggle.set_active(is_auto_set_time)
        self.auto_time_toggle.connect("toggled", self.__toggled, "auto_time_toggle")
        self.auto_time_toggle_align.add(self.auto_time_toggle)
        '''
        set time
        '''
        self.set_time_spin_align = self.__setup_align(padding_left = 10, padding_top = 1)
        self.set_time_box = gtk.HBox(spacing = BETWEEN_SPACING)
        self.set_time_label = self.__setup_label(_("Set Time"), 60)
        self.set_time_spin = TimeSpinBox(is_24hour = self.is_24hour)                 
        self.set_time_spin.set_size_request(85, WIDGET_HEIGHT)                               
        self.set_time_spin.connect("value-changed", self.__time_changed)
        self.__widget_pack_start(self.set_time_box, 
            [self.set_time_label, self.set_time_spin])
        self.set_time_spin_align.add(self.set_time_box)
        self.__widget_pack_start(self.auto_time_box, 
                                 [
                                  self.auto_time_label, 
                                  self.auto_time_toggle_align, 
                                  self.set_time_spin_align]) 
        if is_auto_set_time:
            self.set_time_spin_align.set_child_visible(False)
        self.auto_time_align.add(self.auto_time_box)
        '''
        24hour display
        '''
        self.time_display_align = self.__setup_align(padding_top = BETWEEN_SPACING)
        self.time_display_box = gtk.HBox(spacing = BETWEEN_SPACING)
        self.time_display_label = self.__setup_label("24 %s" % _("Hour"))
        self.time_display_toggle_align = self.__setup_align()
        self.time_display_toggle = self.__setup_toggle()                        
        self.time_display_toggle.set_active(self.is_24hour)                          
        self.time_display_toggle.connect("toggled", self.__toggled, "time_display_toggle")
        self.time_display_toggle_align.add(self.time_display_toggle)
        self.__widget_pack_start(self.time_display_box, 
            [self.time_display_label, self.time_display_toggle_align])
        self.time_display_align.add(self.time_display_box)
        '''
        timezone
        '''
        self.timezone_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/globe-green.png"), 
            _("Time Zone"), 
            TEXT_WINDOW_TOP_PADDING)
        self.timezone_combo_align = self.__setup_align(padding_top = 6)
        self.timezone_combo = ComboBox(self.timezone_items, max_width = 340, fixed_width = 340)
        self.timezone_combo.set_select_index(self.__deepin_dt.get_gmtoff() + 11)
        self.timezone_combo.connect("item-selected", self.__combo_item_selected)
        self.timezone_combo_align.add(self.timezone_combo)

        self.__widget_pack_start(self.right_box, 
                                 [self.time_title_align, 
                                  self.cur_time_align, 
                                  self.datetime_widget_align, 
                                  self.auto_time_align, 
                                  self.time_display_align, 
                                  self.timezone_title_align, 
                                  self.timezone_combo_align])
        self.right_align.add(self.right_box)
       
        self.__widget_pack_start(self, [self.left_align, self.right_align])

        self.connect("expose-event", self.__expose)

        self.__send_message("status", ("date_time", ""))

        SecondThread(self).start()
        DateThread(self).start()
# 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/>.

try:                                                                             
    import deepin_gsettings                                                      
except ImportError:                                                             
    print "----------Please Install Deepin GSettings Python Binding----------"   
    print "git clone [email protected]:linuxdeepin/deepin-gsettings.git"            
    print "------------------------------------------------------------------"   

MOUSE_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.mouse"
MOUSE_SETTINGS = deepin_gsettings.new(MOUSE_SETTINGS_CONF)

MOUSE_DEFAULT_SETTINGS = {
    "left_handed"           : False,
    "motion_acceleration"   : 1.0,
    "motion_threshold"      : 1,
    "double_click"          : 400}

def mouse_set_left_handed(left_handed):
    '''
    set mouse is left-handed
    @param left_handed: is left hand, a bool type
    '''
    MOUSE_SETTINGS.set_boolean("left-handed", left_handed)

Beispiel #14
0
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
#               2011 ~ 2012 Wang Yong
#
# Author:     Wang Yong <*****@*****.**>
# Maintainer: Wang Yong <*****@*****.**>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# 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/>.

try:
    import deepin_gsettings
    DESKTOP_SETTINGS_CONF = "org.gnome.desktop.interface"
    DESKTOP_SETTINGS = deepin_gsettings.new(DESKTOP_SETTINGS_CONF)
except ImportError:
    print "----------Please Install Deepin GSettings Python Binding----------"
    print "sudo apt-get install python-deepin-gsettings"
    print "------------------------------------------------------------------"

DEFAULT_CURSOR_BLINK_TIME = 600  # microsecond

Beispiel #15
0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# 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 deepin_gsettings

nst_settings = deepin_gsettings.new("org.gnome.Bluetooth.nst")
contacts_settings = deepin_gsettings.new("org.gnome.Contacts")
sendto_settings = deepin_gsettings.new("org.gnome.Nautilus.Sendto")


def get_last_used_device():
    '''The last Bluetooth device we sent files to'''
    return nst_settings.get_string("last-used")


def set_last_used_device(address):
    nst_settings.set_string("last-used", address)


def get_contacts_first_setup():
    if contacts_settings.get_boolean("did-initial-setup") == None:
 def __init__(self):
     self.proxy_settings = deepin_gsettings.new(PROXY_SETTINGS)
     self.ftp_settings = deepin_gsettings.new(FTP_SETTINGS)
     self.http_settings = deepin_gsettings.new(HTTP_SETTINGS)
     self.https_settings = deepin_gsettings.new(HTTPS_SETTINGS)
     self.socks_settings = deepin_gsettings.new(SOCKS_SETTINGS)
# typing setting
KEYBOARD_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.keyboard"
TOUCHPAD_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.touchpad"
DESKTOP_SETTINGS_CONF = "org.gnome.desktop.interface"
# layout setting
XKB_DESKTOP_SETTINGS_CONF = "org.gnome.libgnomekbd.desktop"
XKB_KEYBOARD_SETTINGS_CONF = "org.gnome.libgnomekbd.keyboard"
# shortcuts setting
WM_SHORTCUTS_SETTINGS_CONF = "org.gnome.desktop.wm.keybindings"
SHORTCUTS_SETTINGS_CONF = "org.gnome.settings-daemon.plugins.media-keys"
DP_SHORTCUTS_SETTINGS_CONF = "org.gnome.settings-daemon.plugins.key-bindings"
COMPIZ_SHORTCUTS_SETTINGS_CONF = "org.compiz"

# typing setting
KEYBOARD_SETTINGS = deepin_gsettings.new(KEYBOARD_SETTINGS_CONF)
TOUCHPAD_SETTINGS = deepin_gsettings.new(TOUCHPAD_SETTINGS_CONF)
DESKTOP_SETTINGS = deepin_gsettings.new(DESKTOP_SETTINGS_CONF)
# layout setting
XKB_DESKTOP_SETTINGS = deepin_gsettings.new(XKB_DESKTOP_SETTINGS_CONF)
XKB_KEYBOARS_SETTINGS = deepin_gsettings.new(XKB_KEYBOARD_SETTINGS_CONF)
# shortcuts setting
WM_SHORTCUTS_SETTINGS = deepin_gsettings.new(WM_SHORTCUTS_SETTINGS_CONF)
SHORTCUTS_SETTINGS = deepin_gsettings.new(SHORTCUTS_SETTINGS_CONF)
DP_SHORTCUTS_SETTINGS = deepin_gsettings.new(DP_SHORTCUTS_SETTINGS_CONF)
COMPIZ_SHORTCUTS_SETTINGS = deepin_gsettings.new(COMPIZ_SHORTCUTS_SETTINGS_CONF)
GCONF_CLIENT = gconf.client_get_default()

KEYBOARD_DEFAULT_SETTINGS = {
    # keyboard set
    "delay"                : 500,
        
        if not os.path.exists(untitled_path):
            untitled_theme.set_default_name("untitled")    
            untitled_theme.set_locale_name(_("Untitled"))
            untitled_theme.save()    
        
        return untitled_theme
    
    def is_current_theme(self, theme):
        return theme.location == global_settings.get_option("settings/theme", "")
    
    def apply_theme(self, theme):
        duration = theme.get_background_duration()
        draw_mode = theme.get_background_draw_mode()
        random_mode = theme.get_background_random_mode(True)
        image_paths = theme.get_enable_wallpaper_paths()
        if image_paths:
            image_uris = ";".join(["file://%s" % path for path in image_paths])
            background_gsettings.set_string("picture-uris", image_uris)
        else:
            background_gsettings.set_string("picture-uris", "")
        background_gsettings.set_int("background-duration", duration)
        # background_gsettings.set_string("draw-mode", draw_mode)
        # background_gsettings.set_string("cross-fade-auto-mode", random_mode)
        global_settings.set_option("settings/theme", theme.location)
        global_settings.save()
        
        
theme_manager = ThemeManager()
background_gsettings = background_gsettings = deepin_gsettings.new("com.deepin.dde.background")
 def __init__(self, schema_id):
     '''
     DeepinGSettings construction
     @para schema_id
     '''
     self.handle = deepin_gsettings.new(schema_id)
Beispiel #20
0
    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.desktop_settings = deepin_gsettings.new("com.deepin.dde.desktop")
        self.dock_settings = deepin_gsettings.new("com.deepin.dde.dock")
        self.compiz_integrated_settings = deepin_gsettings.new("org.compiz.integrated")
        self.compiz_core_settings = deepin_gsettings.new_with_path(
            "org.compiz.core", "/org/compiz/profiles/deepin/plugins/core/")
        self.compiz_run_command_edge_settings = deepin_gsettings.new_with_path(
            "org.compiz.commands", "/org/compiz/profiles/deepin/plugins/commands/")
        self.compiz_scale_settings = deepin_gsettings.new_with_path("org.compiz.scale",
            "/org/compiz/profiles/deepin/plugins/scale/")
        self.compiz_grid_settings = deepin_gsettings.new_with_path("org.compiz.grid",
            "/org/compiz/profiles/deepin/plugins/grid/")
        
        self.settings = [self.desktop_settings, self.dock_settings, self.compiz_integrated_settings,
                         self.compiz_core_settings, self.compiz_run_command_edge_settings, self.compiz_scale_settings,
                         self.compiz_grid_settings]
        self.__set_settings_changed_handler()

        self.display_style_items = [(_("Default Style"), 0),
                                    (_("Auto Hide"), 1),
                                    (_("Invisible"), 2)]
        self.place_style_items = [(_("Bottom"), 0),
                                  (_("Top"), 1)]
        self.icon_size_items = [(_("Default Icon"), 0),
                                (_("Small"), 1)]
        self.hot_zone_items = [(_("Nothing"), 0),
                               (_("Opening Window"), 1),
                               (_("Launcher"), 2)]
        self.grid_items = [(_("Maximize"), 0), (_("Nothing"), 1)]
        '''
        icon title
        '''
        self.icon_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("desktop/icon.png"),
            _("Desktop Icon"),
            TEXT_WINDOW_TOP_PADDING,
            TEXT_WINDOW_LEFT_PADDING)
        '''
        icon
        '''
        self.icon_align = self.__setup_align(padding_left = 265)
        self.icon_box = gtk.VBox(spacing = WIDGET_SPACING)
        self.computer_checkbutton = self.__setup_checkbutton(_("Computer"))
        self.computer_checkbutton.set_active(self.desktop_settings.get_boolean("show-computer-icon"))
        self.computer_checkbutton.connect("toggled", self.__toggled, "computer");
        self.home_checkbutton = self.__setup_checkbutton(_("Home"))
        self.home_checkbutton.set_active(self.desktop_settings.get_boolean("show-home-icon"))
        self.home_checkbutton.connect("toggled", self.__toggled, "home")
        self.trash_checkbutton = self.__setup_checkbutton(_("Trash"))
        self.trash_checkbutton.set_active(self.desktop_settings.get_boolean("show-trash-icon"))
        self.trash_checkbutton.connect("toggled", self.__toggled, "trash")
        self.dsc_checkbutton = self.__setup_checkbutton(_("Software Center"))
        self.dsc_checkbutton.set_active(self.desktop_settings.get_boolean("show-dsc-icon"))
        self.dsc_checkbutton.connect("toggled", self.__toggled, "dsc")
        self.__widget_pack_start(self.icon_box,
                                 [self.computer_checkbutton,
                                  self.home_checkbutton,
                                  self.trash_checkbutton,
                                  self.dsc_checkbutton,
                                 ])
        self.icon_align.add(self.icon_box)
        '''
        dock title
        '''
        self.dock_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("desktop/dock.png"),
            _("Dock"))
        '''
        display style
        '''
        self.display_style_align = self.__setup_align()
        self.display_style_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.display_style_label = self.__setup_label(_("Display Style"))
        self.display_style_combo = self.__setup_combo(self.display_style_items)
        hide_mode = self.dock_settings.get_string("hide-mode")
        hide_mode_index = 0
        if hide_mode == "default":
            hide_mode_index = 0
        elif hide_mode == "autohide":
            hide_mode_index = 1
        else:
            hide_mode_index = 2
        self.display_style_combo.set_select_index(hide_mode_index)
        self.display_style_combo.connect("item-selected", self.__combo_item_selected, "display_style")
        self.__widget_pack_start(self.display_style_box,
            [self.display_style_label, self.display_style_combo])
        self.display_style_align.add(self.display_style_box)
        '''
        place style
        '''
        self.place_style_align = self.__setup_align()
        self.place_style_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.place_style_label = self.__setup_label(_("Place Style"))
        self.place_style_combo = self.__setup_combo(self.place_style_items)
        self.place_style_combo.set_select_index(0)
        self.place_style_combo.connect("item-selected", self.__combo_item_selected, "place_style")
        self.__widget_pack_start(self.place_style_box,
            [self.place_style_label, self.place_style_combo])
        self.place_style_align.add(self.place_style_box)
        '''
        icon size
        '''
        self.icon_size_align = self.__setup_align()
        self.icon_size_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.icon_size_label = self.__setup_label(_("Icon Size"))
        self.icon_size_combo = self.__setup_combo(self.icon_size_items)
        self.icon_size_combo.set_select_index(0)
        if self.dock_settings.get_boolean("active-mini-mode"):
            self.icon_size_combo.set_select_index(1)
        self.icon_size_combo.connect("item-selected", self.__combo_item_selected, "icon_size")
        self.__widget_pack_start(self.icon_size_box,
            [self.icon_size_label, self.icon_size_combo])
        self.icon_size_align.add(self.icon_size_box)
        '''
        preview
        '''
        self.preview_align = self.__setup_align()
        self.preview_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.preview_label = self.__setup_label(_("Preview"))
        self.__widget_pack_start(self.preview_box, [self.preview_label])
        self.preview_align.add(self.preview_box)
        '''
        hot zone
        '''
        self.hot_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("desktop/hot.png"),
            _("Hot Zone"))
        self.topleft_align = self.__setup_align()
        self.topleft_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.topleft_label = self.__setup_label(_("Top Left"))
        self.topleft_combo = self.__setup_combo(self.hot_zone_items)
        command1 = self.compiz_integrated_settings.get_string("command-11")
        if command1 == "":
            self.topleft_combo.set_select_index(0)
        elif command1 == self.LAUNCHER_CMD:
            self.topleft_combo.set_select_index(2)
        else:
            pass

        scale_edge_str = self.compiz_scale_settings.get_string("initiate-edge")
        if scale_edge_str == "TopLeft":
            self.topleft_combo.set_select_index(1)

        self.topleft_combo.connect("item-selected", self.__combo_item_selected, "topleft")
        self.__widget_pack_start(self.topleft_box, [self.topleft_label, self.topleft_combo])
        self.topleft_align.add(self.topleft_box)
        self.topright_align = self.__setup_align()
        self.topright_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.topright_label = self.__setup_label(_("Bottom Right"))
        self.topright_combo = self.__setup_combo(self.hot_zone_items)
        command2 = self.compiz_integrated_settings.get_string("command-12")
        if command2 == "":
            self.topright_combo.set_select_index(0)
        elif command2 == self.LAUNCHER_CMD:
            self.topright_combo.set_select_index(2)
        else:
            pass

        if scale_edge_str == "BottomRight":
            self.topright_combo.set_select_index(1)

        self.topright_combo.connect("item-selected", self.__combo_item_selected, "topright")
        self.__widget_pack_start(self.topright_box, [self.topright_label, self.topright_combo])
        self.topright_align.add(self.topright_box)
        '''
        top edge
        '''
        self.topedge_align = self.__setup_align()
        self.topedge_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.topedge_label = self.__setup_label(_("Top Edge"))
        self.topedge_combo = self.__setup_combo(self.grid_items)
        top_edge_action = self.compiz_grid_settings.get_int("top-edge-action")
        if top_edge_action == 10:
            self.topedge_combo.set_select_index(0)
        else:
            self.topedge_combo.set_select_index(1)
        self.topedge_combo.connect("item-selected", self.__combo_item_selected, "topedge")
        self.__widget_pack_start(self.topedge_box, [self.topedge_label, self.topedge_combo])
        self.topedge_align.add(self.topedge_box)
        self.leftedge_align = self.__setup_align()
        self.leftedge_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.leftedge_label = self.__setup_label(_("Left Edge"))
        self.leftedge_combo = self.__setup_combo(self.grid_items)
        left_edge_action = self.compiz_grid_settings.get_int("left-edge-action")
        if left_edge_action == 10:
            self.leftedge_combo.set_select_index(0)
        else:
            self.leftedge_combo.set_select_index(1)
        self.leftedge_combo.connect("item-selected", self.__combo_item_selected, "leftedge")
        self.__widget_pack_start(self.leftedge_box, [self.leftedge_label, self.leftedge_combo])
        self.leftedge_align.add(self.leftedge_box)
        self.rightedge_align = self.__setup_align()
        self.rightedge_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.rightedge_label = self.__setup_label(_("Right Edge"))
        self.rightedge_combo = self.__setup_combo(self.grid_items)
        right_edge_action = self.compiz_grid_settings.get_int("right-edge-action")
        if right_edge_action == 10:
            self.rightedge_combo.set_select_index(0)
        else:
            self.rightedge_combo.set_select_index(1)
        self.rightedge_combo.connect("item-selected", self.__combo_item_selected, "rightedge")
        self.__widget_pack_start(self.rightedge_box, [self.rightedge_label, self.rightedge_combo])
        self.rightedge_align.add(self.rightedge_box)
        '''
        greeter
        '''
        self.greeter_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("desktop/lock.png"),
            _("Login &amp;&amp; Lock"),
            TEXT_WINDOW_TOP_PADDING,
            TEXT_WINDOW_LEFT_PADDING)
        '''
        greeter
        '''
        self.greeter_align = self.__setup_align()
        self.greeter_box = gtk.HBox()
        self.greeter_label = self.__setup_label(_("Login Page"))
        self.greeter_entry_align = self.__setup_align(
            padding_left = WIDGET_SPACING, padding_top = 3)
        self.greeter_entry = self.__setup_entry()
        self.greeter_entry_align.add(self.greeter_entry)
        self.greeter_button = self.__setup_button(_("Select"))
        self.__widget_pack_start(self.greeter_box,
                                 [self.greeter_label,
                                  self.greeter_entry_align,
                                  self.greeter_button])
        self.greeter_align.add(self.greeter_box)
        '''
        lock
        '''
        self.lock_align = self.__setup_align()
        self.lock_box = gtk.HBox()
        self.lock_label = self.__setup_label(_("Lock Page"))
        self.lock_entry_align = self.__setup_align(
            padding_left = WIDGET_SPACING, padding_top = 3)
        self.lock_entry = self.__setup_entry()
        self.lock_entry_align.add(self.lock_entry)
        self.lock_button = self.__setup_button(_("Select"))
        self.__widget_pack_start(self.lock_box,
                                 [self.lock_label,
                                  self.lock_entry_align,
                                  self.lock_button])
        self.lock_align.add(self.lock_box)
        '''
        this->gtk.VBox pack_start
        '''
        self.__widget_pack_start(self,
                                 [self.icon_title_align,
                                  self.icon_align,
                                  self.dock_title_align,
                                  self.display_style_align,
                                  #self.place_style_align,
                                  #self.icon_size_align,
                                  #self.preview_align,
                                  self.hot_title_align,
                                  self.topleft_align,
                                  self.topright_align,
                                  #self.topedge_align,
                                  #self.leftedge_align,
                                  #self.rightedge_align,
                                  #self.greeter_title_align,
                                  #self.greeter_align,
                                  #self.lock_align
                                 ])

        self.connect("expose-event", self.__expose)

        self.__send_message("status", ("desktop", ""))

        self.__check_active_plugins()
def is_laptop():
    xrandr_settings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.xrandr")
    return xrandr_settings.get_boolean("is-laptop")
Beispiel #22
0
 def __init__(self, schema_id):
     '''
     DeepinGSettings construction
     @para schema_id
     '''
     self.handle = deepin_gsettings.new(schema_id)
# 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 os
from glob import iglob
from future_builtins import map
from ConfigParser import ConfigParser, NoOptionError
from functools import partial
import deepin_gsettings

SECTION = 'Desktop Entry'
DEFAULT_CATEGORIES = set(["AudioVideo", "Audio", "Video", "Development", "Education", "Game", "Graphics",
                          "Network", "Office", "Settings", "System", "Utility"])

TerminalEmulator = "TerminalEmulator"
gnome_terminal_gsettings = deepin_gsettings.new("org.gnome.desktop.default-applications.terminal")
deepin_terminal_gsettings = deepin_gsettings.new("com.deepin.desktop.default-applications.terminal")

x_terminals = ("gnome-terminal", "terminator")
terminal_blacklist = ['guake']

class DesktopEntry(ConfigParser):
    def __init__(self, filename):
        ConfigParser.__init__(self)
        self.filename = filename
        try:
            self.read(filename)
        except:
            pass

    def __repr__(self):
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# 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 deepin_gsettings

nst_settings = deepin_gsettings.new("org.gnome.Bluetooth.nst")
contacts_settings = deepin_gsettings.new("org.gnome.Contacts")
sendto_settings = deepin_gsettings.new("org.gnome.Nautilus.Sendto")

def get_last_used_device():
    '''The last Bluetooth device we sent files to'''
    return nst_settings.get_string("last-used")

def set_last_used_device(address):
    nst_settings.set_string("last-used", address)

def get_contacts_first_setup():
    if contacts_settings.get_boolean("did-initial-setup") == None:
        return False
    return contacts_settings.get_boolean("did-initial-setup")
Beispiel #25
0
app_theme = init_skin(
    "deepin-ui-demo", 
    "1.0",
    "01",
    os.path.join(get_parent_dir(__file__), "skin"),
    os.path.join(get_parent_dir(__file__), "app_theme"),
    )

from dtk.ui.application import Application
from dtk.ui.scalebar import HScalebar
from dtk.ui.constant import DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT
import gtk
import deepin_gsettings
import gtk

dg = deepin_gsettings.new("org.gnome.settings-daemon.plugins.xrandr")

def __changed(key):
    print "DEBUG key", key, dg.get_double(key)

dg.connect("changed", __changed)

def __value_changed(widget, argv):
    print "DEBUG argv", argv

def __resized(widget):
    print widget

if __name__ == "__main__":
    # Init application.
    #application = Application()
# 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/>.

try:                                                                             
    import deepin_gsettings                                                      
except ImportError:                                                                 
    print "----------Please Install Deepin GSettings Python Binding----------"   
    print "git clone [email protected]:linuxdeepin/deepin-gsettings.git"            
    print "------------------------------------------------------------------"   
from gtk import gdk

MOUSE_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.mouse"
TOUCHPAD_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.touchpad"
MOUSE_SETTINGS = deepin_gsettings.new(MOUSE_SETTINGS_CONF)
TOUCHPAD_SETTINGS = deepin_gsettings.new(TOUCHPAD_SETTINGS_CONF)

TOUCHPAD_DEFAULT_SETTINGS = {
    "left_handed"           : "mouse",
    "motion_acceleration"   : -1.0,
    "motion_threshold"      : -1,
    # MOUSE_DEFAULT_SETTINGS
    "double_click"          : 400,
    "drag_threshold"        : 8}


def touchpad_set_left_handed(left_handed):
    '''
    set touchpad is left-handed
    @param left_handed: is left hand, a string type. must be one of ["left", "right", "mouse"]
Beispiel #27
0
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
#               2011 ~ 2012 Wang Yong
# 
# Author:     Wang Yong <*****@*****.**>
# Maintainer: Wang Yong <*****@*****.**>
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
# 
# This program is distributed in the hope that it will be useful,
# 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/>.

try:
    import deepin_gsettings
    DESKTOP_SETTINGS_CONF = "org.gnome.desktop.interface"
    DESKTOP_SETTINGS = deepin_gsettings.new(DESKTOP_SETTINGS_CONF)
except ImportError:
    print "----------Please Install Deepin GSettings Python Binding----------"
    print "sudo apt-get install python-deepin-gsettings"
    print "------------------------------------------------------------------"

DEFAULT_CURSOR_BLINK_TIME = 600  # microsecond

 def __init__(self):
     self.power_settings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.power")
     self.lockdown_settings = deepin_gsettings.new("org.gnome.desktop.lockdown")
    def __init__(self):
        '''
        init docs
        '''
        gtk.HBox.__init__(self)

        self.__toggle_id = None
        self.__time_id = None

        self.datetime_settings = deepin_gsettings.new(
            "com.deepin.dde.datetime")

        self.__deepin_dt = DeepinDateTime()
        self.current_tz_gmtoff = self.__deepin_dt.get_gmtoff()

        self.timezone_items = []
        self.timezone_items.append((_("(UTC-11:00)Samoa"), -11))
        self.timezone_items.append((_("(UTC-10:00)Hawaii"), -10))
        self.timezone_items.append((_("(UTC-09:00)Alaska"), -9))
        self.timezone_items.append((_("(UTC-08:00)Lower California"), -8))
        self.timezone_items.append(
            (_("(UTC-07:00)Arizona, Llamas, Mazatlan, Chihuahua"), -7))
        self.timezone_items.append(
            (_("(UTC-06:00)Saskatchewan, Mexico City, Monterrey"), -6))
        self.timezone_items.append(
            (_("(UTC-05:00)Indiana, Bogota, Lima, Quito"), -5))
        self.timezone_items.append(
            (_("(UTC-04:00)San Diego, Georgetown, San Juan"), -4))
        self.timezone_items.append(
            (_("(UTC-03:00)Greenland, Brasilia, Fortaleza"), -3))
        self.timezone_items.append((_("(UTC-02:00)Mid-Atlantic"), -2))
        self.timezone_items.append(
            (_("(UTC-01:00)Cape Verde Islands, Azores"), -1))
        self.timezone_items.append(
            (_("(UTC)London, Dublin, Edinburgh, Lisbon, Casablanca"), 0))
        self.timezone_items.append(
            (_("(UTC+01:00)Paris, Amsterdam, Berlin, Rome, Vienna"), 1))
        self.timezone_items.append(
            (_("(UTC+02:00)Cairo, Athens, Istanbul, Jerusalem"), 2))
        self.timezone_items.append(
            (_("(UTC+03:00)Moscow, St. Petersburg, Baghdad"), 3))
        self.timezone_items.append(
            (_("(UTC+04:00)Port Louis, Abu Dhabi, Muscat, Yerevan"), 4))
        self.timezone_items.append(
            (_("(UTC+05:00)Islamabad, Karachi, Tashkent"), 5))
        self.timezone_items.append((_("(UTC+06:00)Dhaka, Novosibirsk"), 6))
        self.timezone_items.append(
            (_("(UTC+07:00)Bangkok, Hanoi, Jakarta"), 7))
        self.timezone_items.append(
            (_("(UTC+08:00)Beijing, Chongqing, HongKong, Taipei, Urumqi"), 8))
        self.timezone_items.append(
            (_("(UTC+09:00)Osaka, Sapporo, Tokyo, Seoul"), 9))
        self.timezone_items.append(
            (_("(UTC+10:00)Guam, Canberra, Melbourne, Sydney"), 10))
        self.timezone_items.append(
            (_("(UTC+11:00)Magadan, Solomon Islands"), 11))
        self.timezone_items.append((_("(UTC+12:00)New Zealand, Kiribati"), 12))
        self.is_24hour = self.datetime_settings.get_boolean("is-24hour")
        '''
        left align
        '''
        self.left_align = self.__setup_align(
            padding_top=TEXT_WINDOW_TOP_PADDING,
            padding_left=TEXT_WINDOW_LEFT_PADDING)
        '''
        left box
        '''
        self.left_box = gtk.VBox()
        '''
        calendar title
        '''
        self.calendar_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/calendar.png"), _("Calendar"))
        '''
        current date
        '''
        self.cur_date_align = self.__setup_align()
        self.cur_date_label = self.__setup_label(
            _("Current Date: %d-%d-%d") %
            (time.localtime().tm_year, time.localtime().tm_mon,
             time.localtime().tm_mday), 190)
        self.cur_date_align.add(self.cur_date_label)
        '''
        calendar widget
        '''
        self.calendar_align = self.__setup_align(padding_top=BETWEEN_SPACING,
                                                 padding_bottom=10)
        self.calendar = deepin_lunar.new()
        if MAIN_LANG == "en_US":
            self.calendar = dltk_calendar.new()
        self.calendar.mark_day(time.localtime().tm_mday)
        self.calendar.get_handle().set_size_request(300, 280)
        self.calendar.get_handle().connect("day-selected",
                                           self.__on_day_selected,
                                           self.calendar)
        self.calendar_align.add(self.calendar.get_handle())
        self.change_date_box = gtk.HBox(spacing=5)
        self.change_date_box.set_size_request(300, -1)
        self.change_date_align = self.__setup_align()
        self.change_date_button = Button(_("Change Date"))
        self.change_date_button.connect("button-press-event",
                                        self.__on_change_date)
        self.change_date_align.add(self.change_date_button)
        self.edit_date_align = self.__setup_align()
        self.edit_date_box = gtk.HBox(spacing=5)
        self.cancel_date_button = Button(_("Cancel"))
        self.cancel_date_button.connect("button-press-event",
                                        self.__on_cancel_change_date)
        self.confirm_date_button = Button(_("Confirm"))
        self.confirm_date_button.connect("button-press-event",
                                         self.__on_confirm_change_date)
        self.__widget_pack_start(
            self.edit_date_box,
            [self.cancel_date_button, self.confirm_date_button])
        self.edit_date_align.add(self.edit_date_box)

        self.change_date_box.pack_end(self.change_date_align, False, False)
        '''
        left box && align
        '''
        self.__widget_pack_start(self.left_box, [
            self.calendar_title_align, self.cur_date_align,
            self.calendar_align, self.change_date_box
        ])
        self.left_align.add(self.left_box)
        '''
        right align
        '''
        self.right_align = self.__setup_align(
            padding_top=TEXT_WINDOW_TOP_PADDING,
            padding_left=TEXT_WINDOW_LEFT_PADDING)
        '''
        right box
        '''
        self.right_box = gtk.VBox()
        '''
        time title
        '''
        self.time_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/time.png"), _("Time"))
        '''
        current time
        '''
        self.cur_time_align = self.__setup_align()
        if self.is_24hour:
            self.cur_time_label = self.__setup_label(
                _("Current Time: %s %02d:%02d:%02d (%d Hour)") %
                (time.strftime('%p'), time.localtime().tm_hour,
                 time.localtime().tm_min, time.localtime().tm_sec, 24), 260)
        else:
            self.cur_time_label = self.__setup_label(
                _("Current Time: %s %02d:%02d:%02d (%d Hour)") %
                (time.strftime('%p'), time.localtime().tm_hour,
                 time.localtime().tm_min, time.localtime().tm_sec, 12), 260)

        self.cur_time_align.add(self.cur_time_label)
        '''
        DateTime widget
        '''
        self.datetime_widget_align = self.__setup_align(
            padding_top=BETWEEN_SPACING)
        self.datetime_widget = DateTimeHTCStyle(is_24hour=self.is_24hour)
        self.datetime_widget_align.add(self.datetime_widget)
        self.set_time_align = self.__setup_align()
        '''
        auto time get && set
        '''
        self.auto_time_align = self.__setup_align(
            padding_top=TEXT_WINDOW_TOP_PADDING)
        self.auto_time_box = gtk.HBox(spacing=BETWEEN_SPACING)
        self.auto_time_label = self.__setup_label(_("NTP"))
        self.auto_time_toggle = self.__setup_toggle()
        is_auto_set_time = self.datetime_settings.get_boolean("is-auto-set")
        if is_auto_set_time:
            #AutoSetTimeThread(self).start()
            self.__deepin_dt.set_using_ntp(True)
        else:
            self.__deepin_dt.set_using_ntp(False)
        self.auto_time_toggle_align = self.__setup_align(padding_top=4)
        self.auto_time_toggle.set_active(is_auto_set_time)
        self.auto_time_toggle.connect("toggled", self.__toggled,
                                      "auto_time_toggle")
        self.auto_time_toggle_align.add(self.auto_time_toggle)
        '''
        set time
        '''
        self.set_time_spin_align = self.__setup_align(padding_left=10,
                                                      padding_top=1)
        self.set_time_box = gtk.HBox(spacing=BETWEEN_SPACING)
        self.set_time_label = self.__setup_label(_("Set Time"), 60)
        self.set_time_spin = TimeSpinBox(is_24hour=self.is_24hour)
        self.set_time_spin.set_size_request(85, WIDGET_HEIGHT)
        self.set_time_spin.connect("value-changed", self.__time_changed)
        self.__widget_pack_start(self.set_time_box,
                                 [self.set_time_label, self.set_time_spin])
        self.set_time_spin_align.add(self.set_time_box)
        self.__widget_pack_start(self.auto_time_box, [
            self.auto_time_label, self.auto_time_toggle_align,
            self.set_time_spin_align
        ])
        if is_auto_set_time:
            self.set_time_spin_align.set_child_visible(False)
        self.auto_time_align.add(self.auto_time_box)
        '''
        24hour display
        '''
        self.time_display_align = self.__setup_align(
            padding_top=BETWEEN_SPACING)
        self.time_display_box = gtk.HBox(spacing=BETWEEN_SPACING)
        self.time_display_label = self.__setup_label("24 %s" % _("Hour"))
        self.time_display_toggle_align = self.__setup_align()
        self.time_display_toggle = self.__setup_toggle()
        self.time_display_toggle.set_active(self.is_24hour)
        self.time_display_toggle.connect("toggled", self.__toggled,
                                         "time_display_toggle")
        self.time_display_toggle_align.add(self.time_display_toggle)
        self.__widget_pack_start(
            self.time_display_box,
            [self.time_display_label, self.time_display_toggle_align])
        self.time_display_align.add(self.time_display_box)
        '''
        timezone
        '''
        self.timezone_title_align = self.__setup_title_align(
            app_theme.get_pixbuf("datetime/globe-green.png"), _("Time Zone"),
            TEXT_WINDOW_TOP_PADDING)
        self.timezone_combo_align = self.__setup_align(padding_top=6)
        self.timezone_combo = ComboBox(self.timezone_items,
                                       max_width=340,
                                       fixed_width=340)
        self.timezone_combo.set_select_index(self.__deepin_dt.get_gmtoff() +
                                             11)
        self.timezone_combo.connect("item-selected",
                                    self.__combo_item_selected)
        self.timezone_combo_align.add(self.timezone_combo)

        self.__widget_pack_start(self.right_box, [
            self.time_title_align, self.cur_time_align,
            self.datetime_widget_align, self.auto_time_align,
            self.time_display_align, self.timezone_title_align,
            self.timezone_combo_align
        ])
        self.right_align.add(self.right_box)

        self.__widget_pack_start(self, [self.left_align, self.right_align])

        self.connect("expose-event", self.__expose)

        self.__send_message("status", ("date_time", ""))

        SecondThread(self).start()
        DateThread(self).start()
Beispiel #30
0
import deepin_gsettings
import urllib
from dtk.ui.thread_pool import MissionThread, MissionThreadPool
from cache_manager import SMALL_SIZE, cache_manager
import random
from dtk.ui.threads import post_gui
import common
from nls import _
import time
from helper import event_manager
from cache_manager import cache_thread_pool
import copy
from bizhi360 import Bizhi360
from xdg_support import get_download_wallpaper_dir

background_gsettings = deepin_gsettings.new("com.deepin.dde.background")

MODULE_NAME = "individuation"

current_background_url = None


class WallpaperView(IconView):
    def __init__(self):
        super(WallpaperView, self).__init__(padding_x=30, padding_y=10)
        self.backgrounds_dir = os.path.join(get_parent_dir(__file__, 2),
                                            "backgrounds")
        self.default_background_files = map(
            lambda filename: os.path.join(self.backgrounds_dir, filename),
            os.listdir(self.backgrounds_dir))
        self.first_part_background_files = self.default_background_files[0:20]
Beispiel #31
0
# 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/>.

try:
    import deepin_gsettings
except ImportError:
    print "----------Please Install Deepin GSettings Python Binding----------"
    print "git clone [email protected]:linuxdeepin/deepin-gsettings.git"
    print "------------------------------------------------------------------"
from gtk import gdk

MOUSE_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.mouse"
TOUCHPAD_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.touchpad"
MOUSE_SETTINGS = deepin_gsettings.new(MOUSE_SETTINGS_CONF)
TOUCHPAD_SETTINGS = deepin_gsettings.new(TOUCHPAD_SETTINGS_CONF)

TOUCHPAD_DEFAULT_SETTINGS = {
    "left_handed": "mouse",
    "motion_acceleration": -1.0,
    "motion_threshold": -1,
    # MOUSE_DEFAULT_SETTINGS
    "double_click": 400,
    "drag_threshold": 8
}


def touchpad_set_left_handed(left_handed):
    '''
    set touchpad is left-handed
import gtk
import os
import sys
import subprocess
import time

sys.path.append("/usr/share/deepin-system-settings/modules/account/src")
from accounts import User
try:
    import deepin_gsettings
except ImportError:
    print "----------Please Install Deepin GSettings Python Binding----------"
    print "git clone [email protected]:linuxdeepin/deepin-gsettings.git"
    print "------------------------------------------------------------------"

power_settings = deepin_gsettings.new("org.gnome.settings-daemon.plugins.power")

DBUS_USER_STR = "/org/freedesktop/Accounts/User%s" % (os.getuid())

SHUTDOWN_TEXT = _("\n<span foreground='#cc5744'>Turn off</span> your computer \
now? \n\nThe system will shut down in %s seconds.")

RESTART_TEXT = _("\n<span foreground='#cc5744'>Restart</span> your computer now?\
\n\nThe system will restart in %s seconds.")

SUSPEND_TEXT = _("\n<span foreground='#cc5744'>Suspend</span> your computer now?\
\n\nThe system will suspend in %s seconds.")

LOGOUT_TEXT = _("\n<span foreground='#cc5744'>Log out</span> of your system now?\
\n\nYou will be automatically logged out in %s seconds.")
 def __init__(self):
     self.proxy_settings = deepin_gsettings.new(PROXY_SETTINGS)
     self.ftp_settings = deepin_gsettings.new(FTP_SETTINGS)
     self.http_settings = deepin_gsettings.new(HTTP_SETTINGS)
     self.https_settings = deepin_gsettings.new(HTTPS_SETTINGS)
     self.socks_settings = deepin_gsettings.new(SOCKS_SETTINGS)
Beispiel #34
0
    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.__background_settings = deepin_gsettings.new(
            "com.deepin.dde.background")

        self.draw_title_background = self.draw_tab_title_background
        self.theme = None

        self.wallpaper_box = gtk.VBox()
        self.window_theme_box = gtk.VBox()
        self.wallpaper_view = WallpaperView(padding_x=30,
                                            padding_y=ITEM_PADDING_Y)
        self.wallpaper_view_sw = self.wallpaper_view.get_scrolled_window()
        self.wallpaper_view_sw.set_size_request(-1, 426)

        position_group, self.position_combobox = get_combo_group(
            _("Position"), DRAW_COMBO_ITEM, self.on_position_combox_selected)
        time_group, self.time_combobox = get_combo_group(
            _("Duration"), TIME_COMBO_ITEM, self.on_time_combox_selected)

        self.__is_random = True
        if self.__background_settings.get_int("background-duration") == 0:
            self.__is_random = False
        self.unorder_play, self.random_toggle = get_toggle_group(
            _("Random"), self.__on_random_toggled, self.__is_random)
        self.button_align = gtk.Alignment()
        self.button_box = gtk.HBox(spacing=5)
        self.select_all_button = Button(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
        self.select_all_button.connect("clicked", self.__on_select_all)
        self.delete_button = Button(_("Delete"))
        self.delete_button.set_size_request(80, WIDGET_HEIGHT)
        self.delete_button.connect("clicked", self.__on_delete)
        self.button_box.pack_start(self.select_all_button, False, False)
        self.button_box.pack_start(self.delete_button, False, False)
        self.button_align.add(self.button_box)

        self.action_bar = gtk.HBox(spacing=26)
        self.action_bar.pack_start(position_group, False, False)
        self.action_bar.pack_start(time_group, False, False)
        self.action_bar.pack_start(self.unorder_play, False, False)
        self.action_bar.pack_end(self.button_align, False, False)
        action_bar_align = gtk.Alignment()
        action_bar_align.set_size_request(-1, STATUS_HEIGHT)
        action_bar_align.set_padding(5, 5, 50, 20)
        action_bar_align.add(self.action_bar)

        self.wallpaper_box.pack_start(self.wallpaper_view_sw, True, True)
        self.wallpaper_box.pack_start(action_bar_align, False, False)

        self.pack_start(self.wallpaper_box, False, False)

        event_manager.add_callback("select-wallpaper",
                                   self.on_wallpaper_select)
        event_manager.add_callback("apply-wallpaper",
                                   self.__on_wallpaper_apply)
        event_manager.add_callback("add-wallpapers", self.__on_add_wallpapers)
import os
from glob import iglob
from future_builtins import map
from ConfigParser import ConfigParser, NoOptionError
from functools import partial
import deepin_gsettings

SECTION = 'Desktop Entry'
DEFAULT_CATEGORIES = set([
    "AudioVideo", "Audio", "Video", "Development", "Education", "Game",
    "Graphics", "Network", "Office", "Settings", "System", "Utility"
])

TerminalEmulator = "TerminalEmulator"
gnome_terminal_gsettings = deepin_gsettings.new(
    "org.gnome.desktop.default-applications.terminal")
deepin_terminal_gsettings = deepin_gsettings.new(
    "com.deepin.desktop.default-applications.terminal")

x_terminals = ("gnome-terminal", "terminator")
terminal_blacklist = ['guake']


class DesktopEntry(ConfigParser):
    def __init__(self, filename):
        ConfigParser.__init__(self)
        self.filename = filename
        try:
            self.read(filename)
        except:
            pass
Beispiel #36
0
def is_laptop():
    xrandr_settings = deepin_gsettings.new(
        "org.gnome.settings-daemon.plugins.xrandr")
    return xrandr_settings.get_boolean("is-laptop")
Beispiel #37
0
import gtk
import os
import sys
import subprocess
import time

sys.path.append("/usr/share/deepin-system-settings/modules/account/src")
from accounts import User
try:
    import deepin_gsettings
except ImportError:
    print "----------Please Install Deepin GSettings Python Binding----------"
    print "git clone [email protected]:linuxdeepin/deepin-gsettings.git"
    print "------------------------------------------------------------------"

power_settings = deepin_gsettings.new(
    "org.gnome.settings-daemon.plugins.power")

DBUS_USER_STR = "/org/freedesktop/Accounts/User%s" % (os.getuid())

SHUTDOWN_TEXT = _("\n<span foreground='#cc5744'>Turn off</span> your computer \
now? \n\nThe system will shut down in %s seconds.")

RESTART_TEXT = _(
    "\n<span foreground='#cc5744'>Restart</span> your computer now?\
\n\nThe system will restart in %s seconds.")

SUSPEND_TEXT = _(
    "\n<span foreground='#cc5744'>Suspend</span> your computer now?\
\n\nThe system will suspend in %s seconds.")

LOGOUT_TEXT = _(
# typing setting
KEYBOARD_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.keyboard"
TOUCHPAD_SETTINGS_CONF = "org.gnome.settings-daemon.peripherals.touchpad"
DESKTOP_SETTINGS_CONF = "org.gnome.desktop.interface"
# layout setting
XKB_DESKTOP_SETTINGS_CONF = "org.gnome.libgnomekbd.desktop"
XKB_KEYBOARD_SETTINGS_CONF = "org.gnome.libgnomekbd.keyboard"
# shortcuts setting
WM_SHORTCUTS_SETTINGS_CONF = "org.gnome.desktop.wm.keybindings"
SHORTCUTS_SETTINGS_CONF = "org.gnome.settings-daemon.plugins.media-keys"
DP_SHORTCUTS_SETTINGS_CONF = "org.gnome.settings-daemon.plugins.key-bindings"
COMPIZ_SHORTCUTS_SETTINGS_CONF = "org.compiz"

# typing setting
KEYBOARD_SETTINGS = deepin_gsettings.new(KEYBOARD_SETTINGS_CONF)
TOUCHPAD_SETTINGS = deepin_gsettings.new(TOUCHPAD_SETTINGS_CONF)
DESKTOP_SETTINGS = deepin_gsettings.new(DESKTOP_SETTINGS_CONF)
# layout setting
XKB_DESKTOP_SETTINGS = deepin_gsettings.new(XKB_DESKTOP_SETTINGS_CONF)
XKB_KEYBOARS_SETTINGS = deepin_gsettings.new(XKB_KEYBOARD_SETTINGS_CONF)
# shortcuts setting
WM_SHORTCUTS_SETTINGS = deepin_gsettings.new(WM_SHORTCUTS_SETTINGS_CONF)
SHORTCUTS_SETTINGS = deepin_gsettings.new(SHORTCUTS_SETTINGS_CONF)
DP_SHORTCUTS_SETTINGS = deepin_gsettings.new(DP_SHORTCUTS_SETTINGS_CONF)
COMPIZ_SHORTCUTS_SETTINGS = deepin_gsettings.new(
    COMPIZ_SHORTCUTS_SETTINGS_CONF)
GCONF_CLIENT = gconf.client_get_default()

KEYBOARD_DEFAULT_SETTINGS = {
    # keyboard set
 def __init__(self):
     self.power_settings = deepin_gsettings.new(
         "org.gnome.settings-daemon.plugins.power")
     self.lockdown_settings = deepin_gsettings.new(
         "org.gnome.desktop.lockdown")