~ubuntu-branches/ubuntu/intrepid/update-manager/intrepid

« back to all changes in this revision

Viewing changes to SoftwareProperties/dialog_edit.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-04-20 18:23:54 UTC
  • Revision ID: james.westby@ubuntu.com-20060420182354-mbpnqmq3owrrvvwu
Tags: 0.42.2ubuntu13
* po/POTFILES.in: add missing desktop file (ubuntu: #39410)
* UpdateManager/UpdateManager.py: 
  - fix in the get_changelog logic (ubuntu: #40058)
  - correct a error in the changelog parser (ubuntu: #40060)
  - fix download size reporting (ubuntu: #39579)
* debian/rules: added dh_iconcache
* setup.py: install the icons into the hicolor icon schema
  (thanks to Sebastian Heinlein)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
      self.gladexml = gtk.glade.XML("%s/glade/SoftwarePropertiesDialogs.glade" % datadir)
42
42
    self.main = self.gladexml.get_widget("dialog_edit")
43
43
    self.main.set_transient_for(parent)
 
44
    self.button_edit_ok = self.gladexml.get_widget("button_edit_ok")
44
45
    
45
46
    # type
46
47
    combo_type = self.gladexml.get_widget("combobox_type")
70
71
    entry = self.gladexml.get_widget("entry_comment")
71
72
    entry.set_text(source_entry.comment)
72
73
 
 
74
    # finally set the signal so that the check function is not tiggered 
 
75
    # during initialisation
 
76
    self.gladexml.signal_connect("on_entry_source_line_changed",
 
77
                                 self.check_line)
 
78
 
 
79
  def check_line(self, *args):
 
80
    """Check for a valid apt line and set the sensitiveness of the
 
81
       button 'add' accordingly"""
 
82
    line = self.get_line()
 
83
    if line == False:
 
84
      self.button_edit_ok.set_sensitive(False)
 
85
      return
 
86
    source_entry = aptsources.SourceEntry(line)
 
87
    if (source_entry.invalid == True or source_entry.disabled == True):
 
88
      self.button_edit_ok.set_sensitive(False)
 
89
    else:
 
90
      self.button_edit_ok.set_sensitive(True)
 
91
 
 
92
  def get_line(self):
 
93
    """Collect all values from the entries and create an apt line"""
 
94
    combo_type = self.gladexml.get_widget("combobox_type")
 
95
    if combo_type.get_active() == 0:
 
96
      line = "deb"
 
97
    else:
 
98
      line = "deb-src"
 
99
 
 
100
    entry = self.gladexml.get_widget("entry_uri")
 
101
    text = entry.get_text()
 
102
    if len(text) < 1 or text.find(" ") != -1 or text.find("#") != -1:
 
103
      return False  
 
104
    line = line + " " + entry.get_text()
 
105
 
 
106
    entry = self.gladexml.get_widget("entry_dist")
 
107
    text = entry.get_text()
 
108
    if len(text) < 1 or text.find(" ") != -1 or text.find("#") != -1:
 
109
      return False    
 
110
    line = line + " " + entry.get_text()
 
111
 
 
112
    entry = self.gladexml.get_widget("entry_comps")
 
113
    text = entry.get_text()
 
114
    if len(text) < 1 or text.find("#") != -1:
 
115
      return False    
 
116
    line = line + " " + entry.get_text()
 
117
 
 
118
    entry = self.gladexml.get_widget("entry_comment")
 
119
    if entry.get_text() != "":
 
120
      line = line + " #" + entry.get_text() + "\n"
 
121
    else:
 
122
      line = line + "\n"
 
123
    return line
 
124
          
73
125
  def run(self):
74
126
      res = self.main.run()
75
127
      if res == gtk.RESPONSE_OK:
76
 
        # get values
77
 
        combo_type = self.gladexml.get_widget("combobox_type")
78
 
        if combo_type.get_active() == 0:
79
 
          line = "deb"
80
 
        else:
81
 
          line = "deb-src"
82
 
        entry = self.gladexml.get_widget("entry_uri")
83
 
        line = line + " " + entry.get_text()
84
 
 
85
 
        entry = self.gladexml.get_widget("entry_dist")
86
 
        line = line + " " + entry.get_text()
87
 
 
88
 
        entry = self.gladexml.get_widget("entry_comps")
89
 
        line = line + " " + entry.get_text()
90
 
 
91
 
        entry = self.gladexml.get_widget("entry_comment")
92
 
        if entry.get_text() != "":
93
 
          line = line + " #" + entry.get_text() + "\n"
94
 
        else:
95
 
          line = line + "\n"
 
128
        line = self.get_line()
96
129
 
97
130
        # change repository
98
131
        index = self.sourceslist.list.index(self.source_entry)