~ubuntu-branches/ubuntu/maverick/rapache/maverick

« back to all changes in this revision

Viewing changes to plugins/advanced/EditDocumentNameGui.py

  • Committer: Bazaar Package Importer
  • Author(s): Emanuele Gentili
  • Date: 2008-10-15 15:44:27 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081015154427-sc86e7urpacfwppr
Tags: 0.7-0ubuntu1
* rapache version bump (LP: #283770)
* debian/patches:
 + removed 01_surf_this_button.patch, fixed in bzr branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Rapache - Apache Configuration Tool
 
4
# Copyright (C) 2008 Stefano Forenza,  Jason Taylor, Emanuele Gentili
 
5
 
6
# This program is free software: you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation, either version 3 of the License, or
 
9
# (at your option) any later version.
 
10
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
import sys
 
20
import re
 
21
import os
 
22
 
 
23
try:
 
24
     import pygtk
 
25
     pygtk.require("2.0")
 
26
except:
 
27
      pass
 
28
try:
 
29
    import gtk
 
30
    import gtk.glade
 
31
except:
 
32
    sys.exit(1)
 
33
 
 
34
from RapacheCore.VirtualHost import *
 
35
from RapacheGtk import GuiUtils
 
36
        
 
37
class EditDocumentNameWindow:
 
38
 
 
39
        def __init__ ( self, glade_path, document = ""):
 
40
                self.return_value = None
 
41
                
 
42
                gladefile = os.path.join(glade_path, "edit_document_name.glade")
 
43
                wtree = gtk.glade.XML(gladefile)
 
44
                
 
45
                self.window = wtree.get_widget("dialog_edit_document_name")
 
46
                self.entry_document = wtree.get_widget("entry_document")
 
47
                self.label_heading = wtree.get_widget("label_heading")
 
48
                self.image_icon = wtree.get_widget("image_icon")
 
49
 
 
50
                signals = {
 
51
                        "on_button_ok_clicked"          : self.on_button_ok_clicked,
 
52
                        "on_button_cancel_clicked"      : self.on_button_cancel_clicked
 
53
                }
 
54
                wtree.signal_autoconnect(signals)
 
55
                
 
56
                # add on destroy to quit loop
 
57
                self.window.connect("destroy", self.on_destroy)
 
58
                
 
59
                if document:
 
60
                        self.entry_document.set_text( document )
 
61
        
 
62
        def run(self):
 
63
                self.window.show()
 
64
                self.entry_document.select_region(0,-1)
 
65
                gtk.main()
 
66
                
 
67
                return self.return_value
 
68
 
 
69
        def on_destroy(self, widget, data=None):
 
70
                gtk.main_quit()
 
71
 
 
72
        def on_button_ok_clicked(self, widget):
 
73
                self.return_value = self.entry_document.get_text()
 
74
                self.window.destroy()
 
75
                return          
 
76
                
 
77
        def on_button_cancel_clicked(self, widget):
 
78
                self.window.destroy()
 
79
                return    
 
80