码迷,mamicode.com
首页 > 编程语言 > 详细

用Python作GIS之三:入口程序 - stargui.py

时间:2015-02-23 16:40:34      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

"""
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()

用Python作GIS之三:入口程序 - stargui.py

标签:

原文地址:http://www.cnblogs.com/columbus2/p/4298082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!