reduced memory footprint by conditionally loading Tk
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.6.0-development+timestamp.2013.07.14.15.49.31
|
Version 2.6.0-development+timestamp.2013.07.14.16.51.54
|
||||||
|
|||||||
+10
-11
@@ -29,15 +29,6 @@ from settings import global_settings
|
|||||||
from shell import run, test
|
from shell import run, test
|
||||||
from utils import is_valid_ip_address, is_loopback_ip_address, getipaddrinfo
|
from utils import is_valid_ip_address, is_loopback_ip_address, getipaddrinfo
|
||||||
|
|
||||||
try:
|
|
||||||
import Tkinter
|
|
||||||
import tkMessageBox
|
|
||||||
import contrib.taskbar_widget
|
|
||||||
from winservice import register_service_handler, Web2pyService
|
|
||||||
have_winservice = True
|
|
||||||
except:
|
|
||||||
have_winservice = False
|
|
||||||
|
|
||||||
|
|
||||||
ProgramName = 'web2py Web Framework'
|
ProgramName = 'web2py Web Framework'
|
||||||
ProgramAuthor = 'Created by Massimo Di Pierro, Copyright 2007-' + str(
|
ProgramAuthor = 'Created by Massimo Di Pierro, Copyright 2007-' + str(
|
||||||
@@ -138,6 +129,7 @@ def start_browser(url, startup=False):
|
|||||||
|
|
||||||
def presentation(root):
|
def presentation(root):
|
||||||
""" Draw the splash screen """
|
""" Draw the splash screen """
|
||||||
|
import Tkinter
|
||||||
|
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
|
|
||||||
@@ -194,6 +186,9 @@ class web2pyDialog(object):
|
|||||||
def __init__(self, root, options):
|
def __init__(self, root, options):
|
||||||
""" web2pyDialog constructor """
|
""" web2pyDialog constructor """
|
||||||
|
|
||||||
|
import Tkinter
|
||||||
|
import tkMessageBox
|
||||||
|
|
||||||
root.title('web2py server')
|
root.title('web2py server')
|
||||||
self.root = Tkinter.Toplevel(root)
|
self.root = Tkinter.Toplevel(root)
|
||||||
self.options = options
|
self.options = options
|
||||||
@@ -321,6 +316,7 @@ class web2pyDialog(object):
|
|||||||
self.button_stop.configure(state='disabled')
|
self.button_stop.configure(state='disabled')
|
||||||
|
|
||||||
if options.taskbar:
|
if options.taskbar:
|
||||||
|
import contrib.taskbar_widget
|
||||||
self.tb = contrib.taskbar_widget.TaskBarIcon()
|
self.tb = contrib.taskbar_widget.TaskBarIcon()
|
||||||
self.checkTaskBar()
|
self.checkTaskBar()
|
||||||
|
|
||||||
@@ -460,6 +456,7 @@ class web2pyDialog(object):
|
|||||||
def error(self, message):
|
def error(self, message):
|
||||||
""" Show error message """
|
""" Show error message """
|
||||||
|
|
||||||
|
import tkMessageBox
|
||||||
tkMessageBox.showerror('web2py start server', message)
|
tkMessageBox.showerror('web2py start server', message)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
@@ -1142,12 +1139,13 @@ def start(cron=True):
|
|||||||
# ## if -W install/start/stop web2py as service
|
# ## if -W install/start/stop web2py as service
|
||||||
if options.winservice:
|
if options.winservice:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
if have_winservice:
|
try:
|
||||||
|
from winservice import register_service_handler, Web2pyService
|
||||||
register_service_handler(
|
register_service_handler(
|
||||||
argv=['', options.winservice],
|
argv=['', options.winservice],
|
||||||
opt_file=options.config,
|
opt_file=options.config,
|
||||||
cls=Web2pyService)
|
cls=Web2pyService)
|
||||||
else:
|
except ImportError:
|
||||||
print 'Error: Missing python module winservice'
|
print 'Error: Missing python module winservice'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
@@ -1188,6 +1186,7 @@ def start(cron=True):
|
|||||||
logger.warn(
|
logger.warn(
|
||||||
'GUI not available because Tk library is not installed')
|
'GUI not available because Tk library is not installed')
|
||||||
havetk = False
|
havetk = False
|
||||||
|
options.nogui = True
|
||||||
|
|
||||||
if options.password == '<ask>' and havetk or options.taskbar and havetk:
|
if options.password == '<ask>' and havetk or options.taskbar and havetk:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user