[GRASS-user] Re: GIS Manager map properties (wxpython)
Tim Michelsen
timmichelsen at gmx-topmail.de
Wed Jun 17 04:27:57 EDT 2009
> > Are the GUI program files byte-compiled into *.pyc files
> > during install?
>
> not sure what happens in the installer, but if not that should happen
> automatically the first time you run it, assuming you have write
> permissions in the install directory.
>
> fwiw using the rc5 native wingrass installer I seem to have only .py
> files in $GISBASE/etc/wxpython/, but do see .pyc in
$GISBASE/etc/wxpython/gui_modules and $GISBASE/python.
>
> (and as you might expect wxgui.py is slow to start)
Below is a script used by PythonXY for opimazation.
Maybe of interest for GRASS, too.
I do not have any further experience with optimazation on windows.
But it happens also on linux that the dialogs take time to pop-up.
For instance calling g.region on CML.
I guess there is happening something inside the wrapper...
(2x1.8Ghz, RAM> 2MB).
BTW, taking about the perfomance of a program shows that the
design has reached a
fairly stable state... These are minor improvements.
First, we need to be happy to have it.
Regards,
Timmie
#### from PythonXY
# -*- coding: latin-1 -*-
#
# Copyright © 2008 Pierre Raybaut
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from PyQt4.QtGui import QApplication, QMessageBox, QFileDialog, QIcon
import os.path as osp
import time, sys, os
from xy.xyutils import getreg
REGXY = getreg()
LIBPATH = osp.join(REGXY['Python'],'Lib')
def optimize(path):
assert osp.exists(path) and osp.isdir(path)
batfile = 'optimize_temp.bat'
f=open(batfile,'w')
f.write('python -O "%s\compileall.py" "%s"' % (LIBPATH,path) )
f.close()
os.startfile(batfile)
time.sleep(3)
os.remove(batfile)
def main():
app = QApplication(sys.argv)
app.setWindowIcon(QIcon(osp.dirname(__file__)+'/img/pyc.png'))
directory = QFileDialog.getExistingDirectory(None,"Select directory to
optimize",osp.join(LIBPATH,'site-packages'))
if not directory.isEmpty() and QMessageBox.question(None, "Optimize",
"Do you really want to compile all .py
files to .pyo in the following directory?"+"\n\n"+directory,
QMessageBox.Yes, QMessageBox.No) ==
QMessageBox.Yes:
optimize(directory)
if __name__ == "__main__":
if len(sys.argv)>1:
optimize(sys.argv[1])
else:
main()
More information about the grass-user
mailing list