File: prefrences.py

package info (click to toggle)
jalali-calendar 1.6.5-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 372 kB
  • ctags: 148
  • sloc: python: 1,462; xml: 1,315; makefile: 57
file content (68 lines) | stat: -rw-r--r-- 2,445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
##
#    
#    Copyright (C) 2007  Mola Pahnadayan
#
#    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 2 of the License, or
#    (at your option) 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, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
##

import os
import pygtk
pygtk.require('2.0')

import gtk,gtk.glade
import gtk.gdk
import calendar
import os.path
import sys
import gconf
import locale

DATA_DIR="/usr/share/jalali-calendar"

class dp:
    def __init__(self):
        self.glade=gtk.glade.XML(DATA_DIR+"/interface.glade","dialog2")
        self.bwindow=self.glade.get_widget("dialog2")
        dict={"on_okbutton1_clicked":self.bsquit,
               "on_dialog2_destroy":self.bquit,
               }
        self.glade.signal_autoconnect(dict)
        
        self.cbutton1=self.glade.get_widget("checkbutton1")
        self.conf_client = gconf.client_get_default()
        self.conf_client.add_dir("/apps/jcalendar", gconf.CLIENT_PRELOAD_NONE)
        show_time=self.conf_client.get_bool("/apps/jcalendar/show_time")
        self.cbutton1.set_active(show_time)

        self.combobox=self.glade.get_widget("combobox3")
        type=show_time=self.conf_client.get_int("/apps/jcalendar/time_type")
        self.combobox.set_active(type)

        self.cbutton2=self.glade.get_widget("checkbutton2")
        show_sec=self.conf_client.get_bool("/apps/jcalendar/show_sec")
        self.cbutton2.set_active(show_sec)
        
    
    def bsquit(self,obg,data=None):
        self.conf_client.set_bool("/apps/jcalendar/show_time", self.cbutton1.get_active())
        self.conf_client.set_int("/apps/jcalendar/time_type", self.combobox.get_active())
        self.conf_client.set_bool("/apps/jcalendar/show_sec", self.cbutton2.get_active())
        self.bwindow.destroy()
        
    def bquit(self,obg,data=None):
        self.bwindow.destroy()