|
用python写的,可以在hiweed linux里用。
- #!/usr/bin/python3.3
- #-*- coding: gb18030 -*-
- import gtk
- import os
- import time
- class pypabout:
- def destroy(self,widget,data=None):
- gtk.main_quit()
- def ok_clicked(self,widget,data=None):
- self.window.destroy()
- def __init__(self):
- self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
- self.window.set_title(unicode("关于pypppoe","gb18030"))
- self.window.set_border_width(10)
- self.window.connect("destroy",self.destroy)
- self.box=gtk.VBox(gtk.FALSE,0)
- self.window.add(self.box)
- self.button_ok=gtk.Button(unicode("确定","gb18030"))
- self.button_ok.connect("clicked",self.ok_clicked)
- self.label=gtk.Label(unicode("pypppoe是一个adsl拨号程序的前端,主要是为了在\n"
- +"hiweed linux下面用图形界面拨号。该程序需要pygtk2.\n"
- +"如果你一直连在网上的话,那么这个东西对你没有用\n"
- +"如果你拨号成功还是不能浏览网页的话,可以尝试一下\n"
- +"路由按钮。添加ppp0为默认路由。\n"
- +"另外,可以在xfce面板上新建一个启动器。是其命令为\n"
- +"gksu pypppoe 这样就不用每次开终端了\n"
- +"如果有问题,可以在我的网页上留言\n"
- +"http://duotaiya.jscn.net\n"
- +"duotaiya@hotmail.com","gb18030"))
- self.box.pack_start(self.label,gtk.TRUE,gtk.TRUE,10)
- self.box.pack_start(self.button_ok,gtk.TRUE,gtk.TRUE,10)
- self.label.show()
- self.button_ok.show()
- self.box.show()
- self.window.show()
-
- def main(self):
- gtk.main()
-
-
- class pypppoe:
- def destroy(self,widget,data=None):
- gtk.main_quit()
- def enable_clicked(self,widget,data=None):
- self.status_bar.push(1,unicode("设备激活中...","gb18030"))
- os.system("pon dsl-provider")
- time.sleep(1)
- self.status_bar.push(1,unicode("完成","gb18030"))
- def route_clicked(self,widget,data=None):
- self.status_bar.push(1,unicode("正在将ppp0设为默认路由...","gb18030"))
- os.system("route add default ppp0")
- time.sleep(1)
- self.status_bar.push(1,unicode("完成","gb18030"))
- def disable_clicked(self,widget,data=None):
- self.status_bar.push(1,unicode("正在解除...","gb18030"))
- os.system("poff dsl-provider")
- time.sleep(1)
- self.status_bar.push(1,unicode("完成","gb18030"))
- def conf_clicked(self,widget,data=None):
- self.status_bar.push(1,unicode("启动pppoeconfig","gb18030"))
- os.system("pppoeconf")
- self.status_bar.push(1,unicode("完成","gb18030"))
- def about_clicked(self,widget,data=None):
- self.status_bar.push(1,unicode("关于","gb18030"))
- about=pypabout()
- about.main()
- self.status_bar.push(1,unicode("完成","gb18030"))
- def __init__(self):
- self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
- self.window.set_title("pypppoe")
- self.window.set_border_width(10)
- self.window.connect("destroy",self.destroy)
- self.box=gtk.HBox(gtk.FALSE,0)
- self.vbox=gtk.VBox(gtk.FALSE,0)
- self.window.add(self.vbox)
- self.vbox.pack_start(self.box,gtk.TRUE,gtk.TRUE,10)
- self.button_enable=gtk.Button(unicode("激活","gb18030"))
- self.button_enable.connect("clicked",self.enable_clicked,None)
- self.button_route=gtk.Button(unicode("路由","gb18030"))
- self.button_route.connect("clicked",self.route_clicked,None)
- self.button_disable=gtk.Button(unicode("解除","gb18030"))
- self.button_disable.connect("clicked",self.disable_clicked,None)
- self.button_conf=gtk.Button(unicode("设置","gb18030"))
- self.button_conf.connect("clicked",self.conf_clicked,None)
- self.button_about=gtk.Button(unicode("关于","gb18030"))
- self.button_about.connect("clicked",self.about_clicked,None)
- self.box.pack_start(self.button_enable,gtk.TRUE,gtk.TRUE,5)
- self.box.pack_start(self.button_route,gtk.TRUE,gtk.TRUE,5)
- self.box.pack_start(self.button_disable,gtk.TRUE,gtk.TRUE,5)
- self.box.pack_start(self.button_conf,gtk.TRUE,gtk.TRUE,5)
- self.box.pack_start(self.button_about,gtk.TRUE,gtk.TRUE,5)
- self.status_bar=gtk.Statusbar()
- self.status_bar.push(1,unicode("准备就绪","gb18030"))
- self.vbox.pack_start(self.status_bar,gtk.TRUE,gtk.TRUE,10)
- self.button_enable.show()
- self.button_route.show()
- self.button_disable.show()
- self.button_conf.show()
- self.button_about.show()
- self.status_bar.show()
- self.vbox.show()
- self.box.show()
- self.window.show()
- def main(self):
- gtk.main()
- if __name__=="__main__":
- pypp=pypppoe()
- pypp.main()
复制代码
大家帮忙提提意见,实在不怎么好用。 |
|