- Timestamp:
- 01/23/09 10:33:16 (3 years ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
ChangeLog (modified) (1 diff)
-
config.yaml (modified) (1 diff)
-
glade/main.glade (modified) (3 diffs)
-
main.py (modified) (3 diffs)
-
plugins/info/info/__init__.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r19 r20 1 2009-01-23 Pedro Gracia <lasarux@gmail.com> 2 3 * config.yaml: 4 * glade/main.glade: 5 * main.py: 6 * plugins/info/info/__init__.py: 7 Add connect button and use a main variable for ssh login 8 1 9 2009-01-19 Pedro Gracia <lasarux@gmail.com> 2 10 -
trunk/config.yaml
r18 r20 15 15 os: linux 16 16 version: debian-etch 17 opensolaris: 18 ip: 127.0.0.1 19 port: 2222 20 user: root 21 os: opensolaris 22 version: 2008.11 17 23 18 24 users: -
trunk/glade/main.glade
r18 r20 242 242 </child> 243 243 <child> 244 <widget class="GtkHBox" id=" hbox1">244 <widget class="GtkHBox" id="vbox4"> 245 245 <property name="visible">True</property> 246 246 <property name="spacing">4</property> … … 257 257 </child> 258 258 <child> 259 <widget class="GtkButton" id="connect_btn"> 260 <property name="visible">True</property> 261 <property name="can_focus">True</property> 262 <property name="receives_default">True</property> 263 <property name="label" translatable="yes">gtk-connect</property> 264 <property name="use_stock">True</property> 265 <property name="response_id">0</property> 266 <signal name="clicked" handler="on_connect_btn_clicked"/> 267 </widget> 268 <packing> 269 <property name="position">1</property> 270 </packing> 271 </child> 272 <child> 259 273 <widget class="GtkButton" id="button1"> 260 274 <property name="visible">True</property> 261 275 <property name="can_focus">True</property> 262 276 <property name="label">gtk-add</property> 263 <property name="use_stock">True</property>264 <property name="response_id">0</property>265 </widget>266 <packing>267 <property name="expand">False</property>268 <property name="fill">False</property>269 <property name="position">1</property>270 </packing>271 </child>272 <child>273 <widget class="GtkButton" id="button2">274 <property name="visible">True</property>275 <property name="can_focus">True</property>276 <property name="label">gtk-remove</property>277 277 <property name="use_stock">True</property> 278 278 <property name="response_id">0</property> … … 282 282 <property name="fill">False</property> 283 283 <property name="position">2</property> 284 </packing> 285 </child> 286 <child> 287 <widget class="GtkButton" id="button2"> 288 <property name="visible">True</property> 289 <property name="can_focus">True</property> 290 <property name="label">gtk-remove</property> 291 <property name="use_stock">True</property> 292 <property name="response_id">0</property> 293 </widget> 294 <packing> 295 <property name="expand">False</property> 296 <property name="fill">False</property> 297 <property name="position">3</property> 284 298 </packing> 285 299 </child> -
trunk/main.py
r18 r20 13 13 from misc.SimpleGladeApp import SimpleGladeApp 14 14 from misc.SimpleGladeApp import bindtextdomain 15 from misc.pexpect import pexpect, pxssh 15 16 import config 16 17 … … 118 119 columns = [('visible', 'str', 'Name'), 119 120 ('visible', 'str', 'OS'), 120 ('visible', 'str', 'IP Address')] 121 ('visible', 'str', 'IP Address'), 122 ('novisible', 'str', 'Port')] 121 123 for i in config.HOSTS: 122 124 j = config.HOSTS[i] 123 row = (i, j["os"], j["ip"]) 125 try: 126 row = (i, j["os"], j["ip"], j["port"]) 127 except: 128 row = (i, j["os"], j["ip"], "22") 124 129 data.append(row) 125 130 self.t = Treeview("list", columns, data, self.treeview) … … 137 142 self.t = Treeview("list", columns, data, self.treeview) 138 143 144 def on_connect_btn_clicked(self, button): 145 self.s = pxssh.pxssh() 146 user = "root" #self.settings["user"] 147 ip = self.settings["ip"] 148 port = self.settings["port"] 149 os = self.settings["os"] 150 if self.s.login(ip, user, port=port): 151 print "login!" 152 else: 153 print "no login!" 154 139 155 def on_treeview_button_release_event(self, widget, event): 140 156 #Get the path at the specific mouse position 141 157 model, iter = widget.get_selection().get_selected() 142 158 self.settings["ip"] = model.get_value(iter, 2) 143 self.settings[" opsys"] = model.get_value(iter, 1)144 145 159 self.settings["port"] = model.get_value(iter, 3) 160 self.settings["os"] = model.get_value(iter, 1) 161 146 162 def on_table_combo_changed(self, widget): 147 163 """Prepare data to show in treeview""" -
trunk/plugins/info/info/__init__.py
r18 r20 25 25 """option in combox has changed""" 26 26 command = widget.get_active_text().lower() 27 self.send_command(command, self.main.get_settings("ip"), self.main.get_settings("opsys")) 27 os = self.main.get_settings("os") 28 self.send_command(command, os) 28 29 29 def send_command(self, command, ip, opsys):30 def send_command(self, command, os): 30 31 textbuffer = self.info_tview.get_buffer() 31 32 textbuffer.set_text("Remoting...") 32 rcommand = self.main.config.get_command(command, opsys) 33 s = pxssh.pxssh() 34 if s.login(ip, self.main.username): 35 s.sendline(rcommand) 36 s.prompt() 37 result = s.before 38 s.logout() 39 textbuffer.set_text(result) 33 rcommand = self.main.config.get_command(command, os) 34 35 s = self.main.s 36 s.sendline(rcommand) 37 s.prompt() 38 result = s.before 39 textbuffer.set_text(result)
