1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

Code separation, added wicd-gtk script

This commit is contained in:
David Paleino
2010-01-02 12:07:46 +01:00
parent 87d1eee5d0
commit a92af3a198
13 changed files with 64 additions and 34 deletions

View File

@@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
exec %PYTHON% -O %LIB%wicd-cli.py $@ exec %PYTHON% -O %LIB%cli/wicd-cli.py $@

View File

@@ -41,5 +41,5 @@ EOF
fi fi
else else
exec %PYTHON% -O %LIB%wicd-client.py $@ exec %BIN%wicd-gtk
fi fi

View File

@@ -6,4 +6,4 @@ if [ -e "%VARLIB%WHEREAREMYFILES" ] && [ ! -L "$HOME/.wicd/WHEREAREMYFILES" ]; t
ln -s "%VARLIB%WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES" ln -s "%VARLIB%WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES"
fi fi
exec %PYTHON% -O %LIB%wicd-curses.py $@ exec %PYTHON% -O %LIB%curses/wicd-curses.py $@

15
in/scripts=wicd-gtk.in Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# check_firstrun()
if [ ! -d "$HOME/.wicd" ]; then
mkdir -p "$HOME/.wicd"
fi
# Make sure the user knows WHEREAREMYFILES ;-)
if [ -e "/var/lib/wicd/WHEREAREMYFILES" ] && [ ! -L "$HOME/.wicd/WHEREAREMYFILES" ]; then
ln -s "/var/lib/wicd/WHEREAREMYFILES" "$HOME/.wicd/WHEREAREMYFILES"
fi
PYTHONPATH=%LIB%
export PYTHONPATH
exec %PYTHON% -O %LIB%gtk/wicd-client.py $@

View File

@@ -1,3 +1,6 @@
#!/bin/bash #!/bin/bash
exec %PYTHON% -O %LIB%wicd-daemon.py $@ PYTHONPATH=%LIB%
export PYTHONPATH
exec %PYTHON% -O %LIB%daemon/wicd-daemon.py $@

View File

@@ -44,6 +44,10 @@ pmutils = '%PMUTILS%'
dbus = '%DBUS%' dbus = '%DBUS%'
desktop = '%DESKTOP%' desktop = '%DESKTOP%'
backends= '%BACKENDS%' backends= '%BACKENDS%'
daemon = '%DAEMON%'
curses = '%CURSES%'
gtk = '%GTK%'
cli = '%CLI%'
translations = '%TRANSLATIONS%' translations = '%TRANSLATIONS%'
icons = '%ICONS%' icons = '%ICONS%'
autostart = '%AUTOSTART%' autostart = '%AUTOSTART%'

View File

@@ -61,6 +61,10 @@ class configure(Command):
('bin=', None, 'set the bin directory'), ('bin=', None, 'set the bin directory'),
('sbin=', None, 'set the sbin directory'), ('sbin=', None, 'set the sbin directory'),
('backends=', None, 'set the backend storage directory'), ('backends=', None, 'set the backend storage directory'),
('daemon=', None, 'set the daemon directory'),
('curses=', None, 'set the curses UI directory'),
('gtk=', None, 'set the GTK UI directory'),
('cli=', None, 'set the CLI directory'),
('networks=', None, 'set the encryption configuration directory'), ('networks=', None, 'set the encryption configuration directory'),
('log=', None, 'set the log directory'), ('log=', None, 'set the log directory'),
('resume=', None, 'set the directory the resume from suspend script is stored in'), ('resume=', None, 'set the directory the resume from suspend script is stored in'),
@@ -113,7 +117,11 @@ class configure(Command):
self.encryption = self.etc + 'encryption/templates/' self.encryption = self.etc + 'encryption/templates/'
self.bin = '/usr/bin/' self.bin = '/usr/bin/'
self.sbin = '/usr/sbin/' self.sbin = '/usr/sbin/'
self.backends = self.lib + 'backends' self.daemon = self.share + 'daemon'
self.backends = self.share + 'backends'
self.curses = self.share + 'curses'
self.gtk = self.share + 'gtk'
self.cli = self.share + 'cli'
self.varlib = '/var/lib/wicd/' self.varlib = '/var/lib/wicd/'
self.networks = self.varlib + 'configurations/' self.networks = self.varlib + 'configurations/'
self.log = '/var/log/wicd/' self.log = '/var/log/wicd/'
@@ -464,7 +472,7 @@ configure yet or you are running it for the first time.'''
data = [] data = []
py_modules=['wicd.networking','wicd.misc','wicd.wnettools', py_modules=['wicd.networking','wicd.misc','wicd.wnettools',
'wicd.wpath','wicd.prefs','wicd.netentry','wicd.dbusmanager', 'wicd.wpath','wicd.dbusmanager',
'wicd.logfile','wicd.backend','wicd.configmanager', 'wicd.logfile','wicd.backend','wicd.configmanager',
'wicd.translations'] 'wicd.translations']
@@ -478,7 +486,7 @@ try:
os.listdir('encryption/templates') if not b.startswith('.')]), os.listdir('encryption/templates') if not b.startswith('.')]),
(wpath.networks, []), (wpath.networks, []),
(wpath.sbin, ['scripts/wicd']), (wpath.sbin, ['scripts/wicd']),
(wpath.lib, ['wicd/monitor.py', 'wicd/wicd-daemon.py', 'wicd/configscript.py', (wpath.daemon, ['wicd/monitor.py', 'wicd/wicd-daemon.py',
'wicd/suspend.py', 'wicd/autoconnect.py']), 'wicd/suspend.py', 'wicd/autoconnect.py']),
(wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']), (wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']),
(wpath.scripts, []), (wpath.scripts, []),
@@ -488,11 +496,11 @@ try:
(wpath.postconnectscripts, []), (wpath.postconnectscripts, []),
] ]
if not wpath.no_install_gtk: if not wpath.no_install_gtk:
py_modules.extend(['wicd.gui', 'wicd.guiutil'])
data.append((wpath.desktop, ['other/wicd.desktop'])) data.append((wpath.desktop, ['other/wicd.desktop']))
data.append((wpath.bin, ['scripts/wicd-client'])) data.append((wpath.bin, ['scripts/wicd-client']))
data.append((wpath.share, ['data/wicd.glade'])) data.append((wpath.gtk, ['wicd/wicd-client.py', 'wicd/netentry.py', 'wicd/prefs.py',
data.append((wpath.lib, ['wicd/wicd-client.py'])) 'wicd/gui.py', 'wicd/guiutil.py', 'data/wicd.glade',
'wicd/configscript.py']))
data.append((wpath.autostart, ['other/wicd-tray.desktop'])) data.append((wpath.autostart, ['other/wicd-tray.desktop']))
if not wpath.no_install_man: if not wpath.no_install_man:
data.append((wpath.mandir + 'man1/', [ 'man/wicd-client.1' ])) data.append((wpath.mandir + 'man1/', [ 'man/wicd-client.1' ]))
@@ -510,18 +518,18 @@ try:
data.append((wpath.icons + '16x16/apps/', ['icons/16px/wicd-client.png'])) data.append((wpath.icons + '16x16/apps/', ['icons/16px/wicd-client.png']))
data.append((wpath.images, [('images/' + b) for b in os.listdir('images') if not b.startswith('.')])) data.append((wpath.images, [('images/' + b) for b in os.listdir('images') if not b.startswith('.')]))
if not wpath.no_install_ncurses: if not wpath.no_install_ncurses:
data.append((wpath.lib, ['curses/curses_misc.py'])) data.append((wpath.curses, ['curses/curses_misc.py']))
data.append((wpath.lib, ['curses/prefs_curses.py'])) data.append((wpath.curses, ['curses/prefs_curses.py']))
data.append((wpath.lib, ['curses/wicd-curses.py'])) data.append((wpath.curses, ['curses/wicd-curses.py']))
data.append((wpath.lib, ['curses/netentry_curses.py'])) data.append((wpath.curses, ['curses/netentry_curses.py']))
data.append((wpath.lib, ['curses/configscript_curses.py'])) data.append((wpath.curses, ['curses/configscript_curses.py']))
data.append((wpath.bin, ['scripts/wicd-curses'])) data.append((wpath.bin, ['scripts/wicd-curses']))
if not wpath.no_install_man: if not wpath.no_install_man:
data.append(( wpath.mandir + 'man8/', ['man/wicd-curses.8'])) data.append(( wpath.mandir + 'man8/', ['man/wicd-curses.8']))
if not wpath.no_install_docs: if not wpath.no_install_docs:
data.append(( wpath.docdir, ['curses/README.curses'])) data.append(( wpath.docdir, ['curses/README.curses']))
if not wpath.no_install_cli: if not wpath.no_install_cli:
data.append((wpath.lib, ['cli/wicd-cli.py'])) data.append((wpath.cli, ['cli/wicd-cli.py']))
data.append((wpath.bin, ['scripts/wicd-cli'])) data.append((wpath.bin, ['scripts/wicd-cli']))
if not wpath.no_install_man: if not wpath.no_install_man:
data.append(( wpath.mandir + 'man8/', ['man/wicd-cli.8'])) data.append(( wpath.mandir + 'man8/', ['man/wicd-cli.8']))

View File

@@ -36,12 +36,12 @@ from dbus import DBusException
from wicd import misc from wicd import misc
from wicd import wpath from wicd import wpath
from wicd import dbusmanager from wicd import dbusmanager
from wicd import prefs
from wicd import netentry
from wicd.misc import noneToString from wicd.misc import noneToString
from wicd.netentry import WiredNetworkEntry, WirelessNetworkEntry import prefs
from wicd.prefs import PreferencesDialog from prefs import PreferencesDialog
from wicd.guiutil import error, LabelEntry import netentry
from netentry import WiredNetworkEntry, WirelessNetworkEntry
from guiutil import error, LabelEntry
from wicd.translations import language from wicd.translations import language
if __name__ == '__main__': if __name__ == '__main__':
@@ -148,7 +148,7 @@ class appGui(object):
self.tray = tray self.tray = tray
gladefile = os.path.join(wpath.share, "wicd.glade") gladefile = os.path.join(wpath.gtk, "wicd.glade")
self.wTree = gtk.glade.XML(gladefile) self.wTree = gtk.glade.XML(gladefile)
self.window = self.wTree.get_widget("window1") self.window = self.wTree.get_widget("window1")
self.window.set_icon_name("wicd-client") self.window.set_icon_name("wicd-client")

View File

@@ -19,7 +19,7 @@
import gtk import gtk
import os.path import os.path
import wpath import wicd.wpath as wpath
HAS_NOTIFY = True HAS_NOTIFY = True
try: try:

View File

@@ -26,13 +26,13 @@ contained within them.
import gtk import gtk
import os import os
import misc import wicd.misc as misc
import wpath import wicd.wpath as wpath
import dbusmanager import wicd.dbusmanager as dbusmanager
from misc import noneToString, stringToNone, noneToBlankString, to_bool from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input
from translations import language from wicd.translations import language
# These get set when a NetworkEntry is instantiated. # These get set when a NetworkEntry is instantiated.
daemon = None daemon = None
@@ -303,7 +303,7 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
def edit_scripts(self, widget=None, event=None): def edit_scripts(self, widget=None, event=None):
""" Launch the script editting dialog. """ """ Launch the script editting dialog. """
profile = self.prof_name profile = self.prof_name
cmdend = [os.path.join(wpath.lib, "configscript.py"), profile, "wired"] cmdend = [os.path.join(wpath.gtk, "configscript.py"), profile, "wired"]
if os.getuid() != 0: if os.getuid() != 0:
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'], cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'],
prog_num=daemon.GetSudoApp()) prog_num=daemon.GetSudoApp())
@@ -408,7 +408,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
def edit_scripts(self, widget=None, event=None): def edit_scripts(self, widget=None, event=None):
""" Launch the script editting dialog. """ """ Launch the script editting dialog. """
cmdend = [os.path.join(wpath.lib, "configscript.py"), cmdend = [os.path.join(wpath.gtk, "configscript.py"),
str(self.networkID), "wireless"] str(self.networkID), "wireless"]
if os.getuid() != 0: if os.getuid() != 0:
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'], cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'],

View File

@@ -39,7 +39,7 @@ daemon = None
wireless = None wireless = None
wired = None wired = None
from translations import language from wicd.translations import language
USER_SETTINGS_DIR = os.path.expanduser('~/.wicd/') USER_SETTINGS_DIR = os.path.expanduser('~/.wicd/')

View File

@@ -60,9 +60,9 @@ except ImportError:
# Wicd specific imports # Wicd specific imports
from wicd import wpath from wicd import wpath
from wicd import misc from wicd import misc
from wicd import gui
from wicd import dbusmanager from wicd import dbusmanager
from wicd.guiutil import error, can_use_notify import gui
from guiutil import error, can_use_notify
from wicd.translations import language from wicd.translations import language

View File

@@ -1790,7 +1790,7 @@ def main(argv):
daemon = WicdDaemon(wicd_bus, auto_connect=auto_connect) daemon = WicdDaemon(wicd_bus, auto_connect=auto_connect)
if not no_poll: if not no_poll:
child_pid = Popen([misc.find_path("python"), "-O", child_pid = Popen([misc.find_path("python"), "-O",
os.path.join(wpath.lib, "monitor.py")], os.path.join(wpath.lib, "daemon", "monitor.py")],
shell=False, close_fds=True).pid shell=False, close_fds=True).pid
atexit.register(on_exit, child_pid) atexit.register(on_exit, child_pid)