~ubuntu-branches/ubuntu/trusty/aptoncd/trusty

« back to all changes in this revision

Viewing changes to APTonCD/widgets/quick_guide.py

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-08-19 21:41:06 UTC
  • mfrom: (3 sid) (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20090819214106-7g72fpzgvl722w6k
* New maintainer (Closes: #542459, #484637, #542501)
* New upstream release
  - Fix the executable flag on non executable files. This fix last lintian
    warnings
* debian/rules: prepared for python2.6 (include of python.mk and use of 
  $(py_setup_install_args) )

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
#####################################################################
 
3
#  Rafael Proença <cypherbios@ubuntu.com>
 
4
#  Laudeci Oliveira <laudeci@gmail.com> 
 
5
#
 
6
#  Copyright 2007 APTonCD DevTeam.
 
7
#
 
8
#  This program is free software; you can redistribute it and/or modify
 
9
#  it under the terms of the GNU General Public License as published
 
10
#  by the Free Software Foundation; version 2 only.
 
11
#
 
12
#  This program is distributed in the hope that it will be useful,
 
13
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#  GNU General Public License for more details.
 
16
#####################################################################
 
17
import gtk
 
18
import re
 
19
import os
 
20
import datetime
 
21
from APTonCD.core import *
 
22
from APTonCD.core import gui 
 
23
from APTonCD.core import constants
 
24
from APTonCD.widgets import *
 
25
 
 
26
WINDOW_NAME = 'dlgQuickGuide'
 
27
 
 
28
class QuickGuideDialog(controller.IController):
 
29
        """
 
30
                This class will show/ask/handle the adding media dialog
 
31
        """
 
32
        def __init__(self, controller = None):
 
33
                """
 
34
                        Constructor
 
35
                """
 
36
                self.controller = controller
 
37
                self.glade = gui.get_glade(constants.PROPERTY_GUI, WINDOW_NAME)
 
38
 
 
39
                #Main widget
 
40
                self.window = gui.get_widget(self.glade, WINDOW_NAME)
 
41
                self.window.set_icon_name(constants.APP_ICON_NAME)
 
42
 
 
43
                #get glade widgets
 
44
                self.chkShowStartup = gui.get_widget(self.glade, 'chkShowStartup')
 
45
                self.cmdClose = gui.get_widget(self.glade, 'cmdClose')
 
46
                
 
47
                if self.controller:
 
48
                        self.window.set_transient_for(self.controller.get_main_window())
 
49
                        self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 
50
 
 
51
                # connect signals
 
52
                self.connect_signals()
 
53
                self.window.set_modal(True)
 
54
 
 
55
        def run(self):
 
56
                return self.window.run()
 
57
 
 
58
        def destroy(self):
 
59
                self.window.destroy()
 
60
 
 
61
        def get_main_window(self):
 
62
                """
 
63
                        implements IController interface method.
 
64
                        for access the class windows object.
 
65
                """
 
66
                if self.controller:
 
67
                        return self.controller.get_main_window()
 
68
                else:
 
69
                        return self.window
 
70
 
 
71
        def get_parent_widget(self):
 
72
                """
 
73
                        implements IController interface method.
 
74
                        for container widget
 
75
                """
 
76
                if self.controller:
 
77
                        self.controller.get_parent_widget()
 
78
                else:
 
79
                        return self.window.get_children()[0]
 
80
 
 
81
        def connect_signals(self):
 
82
                """
 
83
                        This procedure will connect widgets to its signal handler.
 
84
                """
 
85
                gui.connect(self.cmdClose, 'clicked', self.on_clicked)
 
86
 
 
87
        def on_clicked(self, widget):
 
88
                if widget == self.cmdClose:
 
89
                        self.window.destroy()
 
90
        
 
91
        def get_showstartup(self):
 
92
                return self.chkShowStartup.get_active()