wxOneShell:快速生成wxpython多功能图形界面的工具

首页:http://www.oschina.net/action/project/go?id=39680&p=home
   wxOneShell是一个快速开发wxPython SDI程序的框架,wxOneShell的设计 目的,是将程序设计中图像界面的例行功能隔离出来,只用ini文件配置即可完成 Logo屏幕、多面板切换的界面、自动生成菜单和工具条、定义热键、任务条图标 菜单、多语言切 换、控制不同面板的显示等功能,并能辅助界面设计和 保存设置。

    wxOneShell的基本原理是,由wxOneShell.py负责生成图形界面,由ui目 录中的构件负责数据 的显示,而由fs目录中的控制模块控制不同显示数据之间 的操作。

    WxOneShell is a framework for rapid development of wxPython SDI program, wxOneShell is designed, is to isolate the routine function of programming a graphical interface, using ini files configuration generate splash screen, siwitch mulit-panel ,menus and toolbar ,widgets and its hotkey denfine, task bar button menu, and switch multi-language , collect those string to be translated, control panels display etc., and auxiliary interface design and save your settings.

    The Basic principle of wxOneShell is, wxOneShell.py is responsible for generating a graphical interface, components in the directory ui\ are responsible data viwe, and controlled the operations between different data views by control module in fs\ directory .

屏幕快照1

Screen snapshot 1

注意:顶部工具栏部分是部分菜单项的支持类型,更多请看快照2

Note: widgets in toolbar is some menu item types, see snapshot 2 for more.

屏幕快照2

Screen Snapshot 2

*提示:

1.任务条菜单对应主菜单

2.选项菜单是用不同菜单类型制作好的功能构件,可以帮助你制作新程序。

*Note: 

1.Task menu correspond to the main menu

2.The Option menu is already making the function widget well by different menu types, It can help you make a new program.

1.wxOneShell的目录结构

Directory structue of wxOneShell



目录[Directory]

文件[File]

说明

Description

.\


安装目录

Install Directory


wxOneShell.py

主程序。不要编辑。

Main program,Don't edit


wxOneShell.gif

主程序图标

Icon of main program


wxOneShell.ini

界面布局配置文件。定义主界面的参数和不同面 板包含的显示构件,面板的主从关系等

Interface layout profile. Define interface parameters and display panel contains the component, Panel of the master-slave relationship


WxOneShell-ini.py

生成的布局配置py文件,用以保护程序的布局配 置。(可选)

The py file for interface layout profile by generated,use to protect the program profie.(optional)


wxOneShell.jpg

主程序Logo图像文件(可选)

Logo file of main program(optional)

fs\


控制模块目录

Directory of control module


SampleUI.py

控制模块示例

Example of control module


SampleUI.ini

控制模块的设置文件。设置布局构件的大小, 动态隐藏的面板,使用的语言,用户接口信息 等。

Control module configuration file. Setting the size of widgets, hidden settings panel, the language used, and user interface information


SampleUI.mnu

菜单定义文件

The file that define menu


SampleUI-mnu.py

生成菜单py文件,用以保护菜单配置(可选)。

The py file for menu by generated,use to protect the menu setting.(optional)

fs\SampleUI_EXT\
控制模块的目录
The directory for Control module

fs\SampleUI_EXT\lang


控制模块的多语言翻译文件目录

The translation file directory for Control module


Chinese (Simplified).lang         

语言翻译文件(可选)

Language translation files (optional)


English.lang

语言翻译文件(可选)

Language translation files (optional)

functions\


函数模块文件目录

Function module file directory


Languages.py

语言代码对照字典

Language code dictionary


ToolFuncs.py

基本函数文件

Basic Function file


UserFuncs.py

用户自定义函数文件

User-defined functions file


UserFuncs1.py用户自定义函数文件1User-defined functions file 1

images\


图像存放目录

Images Directory


Exit.png

用户图标

User's Icon

OneModules\


wxOneShell基本构件目录

Directory of basic components of wxOneShell


IconsLib.py

内置图标库

Built-in icon library


OneConfig.py

ini文件处理模块

Ini file handling module


OneImages.py图像处理模块Images handling module

OneMasterPanel.py

面板模块

Panel module


OnePanel.py

wxOneShell数据显示固定构件的祖先类模块

ancestor classes module of wxOneShell shows data in a fixed component


OneScrolledPanel.pywxOneShell数据显示滚动构件的祖先类模块ancestor classes module of wxOneShell shows data in a scrollable component

OneUI.py

用户fs模块的祖先类模块

ancestor classes module of user's fs module


.........

ui\


用户自定义构件目录

Directory of User-defined component


SimplePanel.py

构件简单示例文件

Simple example of component


ScrolledPanel.py

滚动构件示例文件

Simple example of scrollable component

modules\</td>
用户自定义模块目录Directory of User-defined modules

HotKey.py

HotKey模块

HotKey module

help\


帮助文件目录

Directory of help file


wxOnShell-help.html本文件

This file

license\


版权声明文件目录

Directory of license


license.txt




lgpl-2.1(include cn version).txt



2.快速开始

2.Quick Start

2.1. 最小的例子

2.1Minimum example

只需要写8行代码

It only need 8 lines code

2.1.1 SimplePanel.py


import OnePanel

class SimplePanel(OnePanel.OnePanel):

    def init(self, parent, top,id, pos, size, style, name):

        OnePanel.OnePanel.init(self, id=id, name=name,parent=parent,top=top,pos=pos, size=size,style=style)

 


2.1.2 SampleUI.py


import OneUI

class SampleUI(OneUI.OneUI):

    def init(self):

       OneUI.OneUI.init(self)

 


2.1.3SimplePanel.py文件放到ui\目录,SampleUI.py放到fs\ 目录。

2.1.3Put SimplePanel.py to ui\,and put SampleUI.py to fs.

2.1.4编写wxOneShell.ini文件,放到程序根目录。

2.1.4 Edit the file wxOneShell.ini,and put it to directory of the program.

[About]

CopyrightPerson=Oneask

CopyrightYear=(C) 2015

Description=a SDI frame for develop wxPython program rapidly

Developers=oneask@gmail.com,cloudherder@126.com

HelpFile=%InstallPath%\help\wxOneShell-help.htm

LicenseFile=%InstallPath%\license\license.txt

ProgramName=wxOneShell

Version=1.0

WebSiteHyperlink=https://github.com/cloudherder/wxOneShell

WebSiteName=wxOneShell GitHub Site


[General]

MasterPane=Viewer

PanelPages=8

Role=Master,Slave,Viewer,Other,ToolFlatBar,ToolListBar,ToolFoldBar,ToolBar

StatusBarFieldCount=5

StatusBarWidths=60,-1,200,100,100


[Viewer]

CanClose=

Caption=

CaptionVisible=

Direction=0

DockSide=Top

FloatPosition=

FsType=SampleUI

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).Resizable(1).MaximizeButton(1).MinimizeButton(1).CloseButton(0).BestSize((320,50)).MinSize((-1,50))

InfoForUpdate=.Center().Row(0).Layer(1).Position(1)

PanelStyle=0

Style=MasterBar

Panel1_PageCloseButton=1

Panel1_TabFixed=

Panel1_TabPosition=

Panel1_TabStyle=2

Panel2_PageCloseButton=1

Panel2_TabFixed=

Panel2_TabPosition=

Panel2_TabStyle=3


[Other]

CanClose=

Caption=

CaptionVisible=

Direction=1

DockSide=Bottom

FloatPosition=

FsType=

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).Resizable(1).MaximizeButton(1).MinimizeButton(0).CloseButton(0).BestSize((-1,50)).MinSize((-1,50)).Direction(1)

InfoForUpdate=.Bottom().Row(0).Layer(1).Position(2)

PanelStyle=0

Style=Master2Panel

Panel1_PageCloseButton=1

Panel1_TabFixed=

Panel1_TabPosition=

Panel1_TabStyle=

Panel2_PageCloseButton=1

Panel2_TabFixed=

Panel2_TabPosition=

Panel2_TabStyle=0


[Slave]

CanClose=

Caption=Right Panel

CaptionVisible=

Direction=1

DockSide=Right

FloatPosition=

FsType=

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).Resizable(1).MaximizeButton(0).MinimizeButton(1).CloseButton(0).BestSize((320,50)).MinSize((-1,50)).Direction(1)

InfoForUpdate=.Right().Row(0).Layer(0).Position(0)

PanelStyle=0

Panel1_PageCloseButton=1

Panel1_TabFixed=

Panel1_TabPosition=Bottom

Panel1_TabStyle=5

Panel2_PageCloseButton=1

Panel2_TabFixed=

Panel2_TabPosition=Bottom

Panel2_TabStyle=3

Style=MasterBar


[ToolBar]

BorderStyle=4

CanClose=

Caption=

CaptionVisible=

Direction=1

DockSide=Bottom

FloatPosition=

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).BottomDockable(1).CloseButton(0).MinimizeButton(0).BestSize((700,45)).MinSize((-1,45)).Direction(1)

InfoForUpdate=.Bottom().Row(1).Layer(3).Position(1)

PanelStyle=0

Style=SideBar

TabPosition=

TabStyle=2

Scrollable=0

ToolStyle=FlatBook


[ToolFlatBar]

BorderStyle=4

CanClose=

Caption=

CaptionVisible=

Direction=1

DockSide=Left-Top

FloatPosition=

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).TopDockable(1).CloseButton(0).MinimizeButton(0).BestSize((800,130)).MinSize((-1,20)).Direction(1)

InfoForUpdate=.Top().Row(0).Layer(1).Position(0)

PanelStyle=0

ToolStyle=FlatBook

Style=SideBar

TabPosition=

TabStyle=3


[ToolFoldBar]

BorderStyle=4

CanClose=1

Caption=

CaptionVisible=

Direction=1

FloatPosition=10,300

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).CloseButton(1).MinimizeButton(0).BestSize((200,130)).MinSize((-1,20))

InfoForUpdate=.Top().Row(0).Layer(1).Position(0)

PanelStyle=0

Style=FoldBar

TabPosition=

TabStyle=


[ToolListBar]

BorderStyle=4

CanClose=1

Caption=

CaptionVisible=

Direction=1

FloatPosition=1000,50

HidenRemainWidth=

InfoForCreate=.CaptionVisible(0).CloseButton(1).MinimizeButton(0).BestSize((150,130)).MinSize((-1,20))

InfoForUpdate=.Top().Row(0).Layer(1).Position(0)

PanelStyle=0

Style=ListBook

TabPosition=Right

TabStyle=


[Master]

CanClose=

Caption=Left Panel

CaptionVisible=

Direction=1

DockSide=Left

FloatPosition=

FsType=

HidenRemainWidth=00

InfoForCreate=.CaptionVisible(0).Resizable(1).MaximizeButton(1).MinimizeButton(1).CloseButton(0).BestSize((320,50)).MinSize((-1,50)).Direction(1)

InfoForUpdate=.Left().Row(0).Layer(1).Position(0)

Panel1_PageCloseButton=1

Panel1_TabFixed=

Panel1_TabPosition=Left

Panel1_TabStyle=1

Panel2_PageCloseButton=1

Panel2_TabFixed=

Panel2_TabPosition=

Panel2_TabStyle=2

PanelStyle=0

Style=MasterBar



2.1.5 运行wxOneShell.py

2.1.5 Run wxOneShell.py

python wxOneShell.py

可得下图

python wxOneShell.py

You will see the UI as following:



*注意:此处是使用了系统默认的fs模块ini参数运行程序,当模块ini文件(此处是Sample.ini)不存在时,会自动生成这一文件。

*Note:This is to use the ini parameter by system default  for fs modules  to run the program , when the ini file for the module(Sample.ini in here) is not exists, this file will be automatically generated.



转载于:https://my.oschina.net/u/67765/blog/513056

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值