"""
gui start file for Space-Time Analysis of Regional Systems
#STARS的图形用户界面入口(高级用户可以直接使用命令行方式进行操作)
----------------------------------------------------------------------
AUTHOR(S): Serge Rey
Mark V. Janikas
Boris Dev
----------------------------------------------------------------------
Copyright (c) 2000-2006 Sergio J. Rey
======================================================================
This source code is licensed under the GNU General Public License,
Version 2. See the file COPYING for more details.
======================================================================
OVERVIEW:
top module for stars gui. all modules should be imported into this module.
methods can be attached to menu callbacks.
#顶层程序,运行该文件时需要保证与其它调用文件在统一目录下
"""
import sys, os, string
from Tkinter import * # widget classes
from guimixin import * # mix-in methods
from guimaker import * # frame, plus menu/toolbar builder
from Numeric import *
import pickle
import os.path
import version
import time
VERSION = version.VERSION
VERSIONDATE = version.DATE
#以上为系统自带的包
from stars import *
import Esda
import Markov
import Inequality
import Mobility
import Data
import Markov
import eda
from Table import Table as RTable
from History import *
from SDialog import *
from pdf import *
import help
import DataViewer as DV
from kmean import Kmeans
import sdialogue as sd
import Utility
import STARSsmoothing as smooth
#以上为stars目录下的包
STARSHOME=options.getSTARSHOME()
PLATFORM=options.getPLATFORM()
ssTop = Tk()
ssTop.title("Welcome to STARS!")
ss=SplashScreen(master=ssTop)
#启动欢迎界面
# view modules
from gView import *
class SProject(Project):
...
class SBroadcast:
...
class SMap(Map,SBroadcast):
...
class STable(Table,SBroadcast):
...
class SMoranScatter(MoranScatter,SBroadcast):
...
class SDensity(Density,SBroadcast):
...
class SCDF(CDF,SBroadcast):
...
class SHistogram(Histogram,SBroadcast):
...
class STimeSeries(TimeSeries,SBroadcast):
...
class SBoxPlot(BoxPlot,SBroadcast):
...
class SpaceTimeButtonMatrix(View):
...
class STimePath(TimePath):
...
class SPCP(PCP):
...
class App(GuiMixin, GuiMaker): # or GuiMakerFrameMenu
"""application level class"""
#其中包含菜单定义与操作
...
if __name__ == '__main__':
import Tkinter
import sys
main = App()
main.disableMenus()
if len(sys.argv) == 1:
main.mainloop()
sys.exit()
else:
# below here are wrapper functions for shell
def openProject():
main.openProject()
def example():
main.example()
def catalogue():
print main.project.catalogue()
def matrixNames():
print main.getMatrixNames()
def openProject():
main.openProject()
def getVariable(name):
return main.project.getVariable(name)
def map(variable,t=[0]):
t=t[0]
title = "%s %s"%(variable.name,variable.timeString[t])
coords = main.project.coords
poly2cs = main.project.poly2cs
cs2poly = main.project.cs2poly
main.drawMap(title,coords,variable[:,t],variable.name,t,
poly2cs,cs2poly)
def boxPlot(variable,timePeriod = [0]):
t = timePeriod[0]
x = variable[:,t]
SBoxPlot(variable.name,main.project,main.master,
x= x,
csids = range(len(x)),
tsids = [t],
allX = variable)
def density(variable,timePeriod = [0]):
t=timePeriod[0]
yAll = variable
tsids = [t] * yAll.t
SDensity("Density",main.master,
main.project,y.name,y[:,t],csid=range(len(y)),
tsid = tsids,
title = "dtitle",xLabel=yAll.name,
xmin = None,
xmax = None)
def quit():
main.master.destroy()
sys.exit(0)
def disableMenus():
main.disableMenus()