productwiz.py :  » Database » PyDO » skunkweb-3.4.4 » SkunkWeb » Services » product » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Database » PyDO 
PyDO » skunkweb 3.4.4 » SkunkWeb » Services » product » productwiz.py
# Time-stamp: <02/02/24 10:40:39 smulloni>

########################################################################
#  
#  Copyright (C) 2002 Jacob Smullyan <smulloni@smullyan.org>
#  
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#   
########################################################################

########################################################################
# you need Rich Salz's excellent wizard.py for this, the original
# source for which is available at:
#
# http://www.zolera.com/resources/opensrc/wizard
#
# This is coded to work with wizard 2.0.
########################################################################

from wizard import *
import Tkinter as Tk
import productmaker
import traceback
import cStringIO

class _productHelp(HelpPopup):
    def __init__(self, helpdict):
        HelpPopup.__init__(self)
        self.helpdict=helpdict
    def open(self, wizard, field):
        self.text=self.helpdict.get(field)
    def readline(self):
        if self.text:
            t=self.text
            self.text=None
            return t
    def close(self):
        pass

_productHelpDict={
    'product_name': "the name of the product you wish to create.",
    'version': 'a version number of the product, such as 1.10.2.',
    'author' : 'the authors of the product.',
    'docroot': """the directory on your machine in which the SkunkWeb
components for this product reside.""",
    'libs' : """the directory on your machine in which the python modules
    (including SkunkWeb services) for this product reside.""",
    'format' : "The desired format for this product (zip, tgz, or tar)",
    'sheet0': 'Enter the name of your new product.',
    'sheet1' : '',
    'sheet2' : ''}

class _sheetchanger:
    def __init__(self):
        self.text=''
    def goto(self, wizard, sheetnum):
        if sheetnum==2:
            
            try:
                ppath=_makeProduct(wizard.get_values())
                wizard.bBack['state']=Tk.DISABLED
                self.text="Your new product was saved as:\n\n %s" % ppath
            except:
                sio=cStringIO.StringIO()
                traceback.print_exc(file=sio)
                self.text="Sorry, an error occurred:\n%s" % sio.getvalue()
    def open(self, wizard):
        pass
    def readline(self):
        if self.text:
            t=self.text[:]
            self.text=''
            return t
    def close(self):
        pass
            
def _get_wizard(root=None):
    builder=_sheetchanger()
    sheets=[Sheet(None,
                  (EntryField('product_name',
                              'Product Name',
                              entrywidth=50,
                              validate=Nonblank('product name')),)),
            Sheet(None, (EntryField('version',
                                    'Version',
                                    entrywidth=10,
                                    validate=Nonblank('version')),
                         EntryField('author',
                                    'Authors',
                                    entrywidth=20),
                         DirField('docroot',
                                  'Document sources',
                                  validate=Nonblank('docroot')),
                         DirField('libs',
                                  'Module sources'),
                         DDField('format',
                                 'Product format',
                                 ['.zip', '.tgz', '.tar']))),
            Sheet(None, (EntryField('services',
                                    'Services',
                                    entrywidth=40),
                         EntryField('dependencies',
                                    'Dependencies',
                                    entrywidth=40))),
            DynamicSheet(None, builder)]
    w=Wizard(sheets,
             'SkunkWeb Product Wizard',
             root,
             whenvalidate=1,
             sheetchange=builder)
    #help=_productHelp(_productHelpDict))
    return w

def _popdict(d, k, lenient=0):
    if d.has_key(k):
        v=d[k]
        del d[k]
        return v
    elif lenient:
        return None
    
def _makeProduct(data):
    productName=_popdict(data, 'product_name')
    docsources=_popdict(data, 'docroot')
    libsources=_popdict(data, 'libs', 1)
    format=('zip', 'tgz', 'tar')[int(_popdict(data, 'format'))]
    productFile=_popdict(data, 'productFile', 1)
    productPath=productmaker.makeProduct(productName,
                                         docsources,
                                         libsources,
                                         data,
                                         format=format,
                                         productFile=productFile)
    
    return productPath

_skunkguin="""
R0lGODlhpgCaAIQAAMDAwKCgoICAgFBQUAAAADAwMHBwcLCwsB8fHw8QD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+JA2fQHRyBZurwUIGi
iy3QNUPTdAXxD0D4lTPQANwxSgawNZskDwq4BAFWKnDZBAvASaJAg13gVt7Ul1wABSb1lkhlUhpi
mF+wAL+2JKnwOdSDlo5pAwtAgumHgl2wAAVxEEfAmZc5mqRZmqZ5mqipO6m5mtLCmq5phq55mbAZ
m4Y5m7QJl7Z5m7q5mwMWAgA7
""".strip()

def main():
    title='SkunkWeb Product Wizard'
    root=Tk.Tk()
    root.title(title)
    root.iconname(title)    
    fr1=Tk.Frame(root)
    imageholder=Tk.Label(fr1)
    pi=Tk.PhotoImage(data=_skunkguin)
    imageholder['image']=pi
    imageholder.grid()
    fr1.grid(row=0, column=0)
    fr2=Tk.Frame(root)
    fr2.grid(row=0, column=1)
    w=_get_wizard(fr2)
    return w.run()

if __name__=='__main__':

    main()
             
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.