bluedevil678
November 22nd, 2011, 02:47 PM
Hi All, I am very new to all this however I am working on a application to automatically enable my wifi on Mint 11 which is soft blocked at start up. Using this as a learning experience Ive decided to code this using the application builder quickly. http://python-forum.org/pythonforum/images/smilies/icon_biggrin.gif
This went smoothly and was able to make a GUI application with a button which at the moment prints the word "Test" ... I would like to know how would I modify my defined function to allow for the processing of instructions normally entered into the terminal? http://python-forum.org/pythonforum/images/smilies/icon_question.gif
Here is the code for that function:
def on button1_clicked (self, button):
print "Test"
return
I would like to know how do I for an example make it so that when the button is clicked it would do the following terminal command: "rfkill unblock 0"
Ive tried playing with the os.system but didnt get very far.
Secondly is it possible to produce the final output which would have been visible in the terminal in the front end application ? http://python-forum.org/pythonforum/images/smilies/icon_mrgreen.gif http://python-forum.org/pythonforum/images/smilies/icon_mrgreen.gif
Here is a copy of the code:
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
import gettext
from gettext import gettext as _
gettext.textdomain('wifi')
import gtk
import logging
logger = logging.getLogger('wifi')
from wifi_lib import Window
from wifi.AboutWifiDialog import AboutWifiDialog
from wifi.PreferencesWifiDialog import PreferencesWifiDialog
# See wifi_lib.Window.py (http://wifi_lib.window.py/) for more details about how this class works
class WifiWindow(Window):
__gtype_name__ = "WifiWindow"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the main window"""
super(WifiWindow, self).finish_initializing(builder)
self.AboutDialog = AboutWifiDialog
self.PreferencesDialog = PreferencesWifiDialog
def on_button1_clicked (self, button):
import os
os.system(rfkill list)
# Code for other initialization actions should be added here.
This went smoothly and was able to make a GUI application with a button which at the moment prints the word "Test" ... I would like to know how would I modify my defined function to allow for the processing of instructions normally entered into the terminal? http://python-forum.org/pythonforum/images/smilies/icon_question.gif
Here is the code for that function:
def on button1_clicked (self, button):
print "Test"
return
I would like to know how do I for an example make it so that when the button is clicked it would do the following terminal command: "rfkill unblock 0"
Ive tried playing with the os.system but didnt get very far.
Secondly is it possible to produce the final output which would have been visible in the terminal in the front end application ? http://python-forum.org/pythonforum/images/smilies/icon_mrgreen.gif http://python-forum.org/pythonforum/images/smilies/icon_mrgreen.gif
Here is a copy of the code:
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
import gettext
from gettext import gettext as _
gettext.textdomain('wifi')
import gtk
import logging
logger = logging.getLogger('wifi')
from wifi_lib import Window
from wifi.AboutWifiDialog import AboutWifiDialog
from wifi.PreferencesWifiDialog import PreferencesWifiDialog
# See wifi_lib.Window.py (http://wifi_lib.window.py/) for more details about how this class works
class WifiWindow(Window):
__gtype_name__ = "WifiWindow"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the main window"""
super(WifiWindow, self).finish_initializing(builder)
self.AboutDialog = AboutWifiDialog
self.PreferencesDialog = PreferencesWifiDialog
def on_button1_clicked (self, button):
import os
os.system(rfkill list)
# Code for other initialization actions should be added here.