2.4. Aplicaciones de escritorio

Usa wxpython

2.4.1. wx Package

2.4.2. application Module

class Application(redirect=True, filename=None, useBestVisual=False, clearSigInt=True)

Bases: wx._core.App

La aplicación wx. Necesita que App ya este configurado.

Bitmap(name)
Icon(name)
Internationalization()
OnInit()
class wxControl

Bases: object

Controlador de modelo MVC para vistas wx

BindEvents()
GetPathUser()
OnClose(event)

2.4.3. globals Module

class DataEvent(data, evt=100)

Bases: wx._core.PyEvent

Evento generico para pasar un diccionario de datos.

GetClipboardText()

Get text from the clipboard @return: string

ImageLoad(name)
class NablaAppConfiguration

Bases: object

Singleton para almacenar rutas y propiedades del sistema

Define(control, view=None)
Dump()
End()
Initialize(script, debug=False)
Menu = {}
Status(*args)
SetClipboardText(text)

Put text in the clipboard @param text: string

SetValues(data, controls)
copyfile(self, origin, dest)

2.4.4. panel Module

class BasePanel(parent, win, frame=None)

Bases: wx._windows.Panel

Panel para edicion de datos, con diccionarios para guardar los widgets y mï¿œtodos de conveniencia.

DataCheck(event=None)
DataGet()
DataModified()
OnButtonCancel(event)
OnInit()
PanButtonsH(parent, buttons)
PanButtonsV(parent, buttons)
Question(title, text)
Status(text)
Border(sizer, border)
class Button(parent, caption, call, image=None, size=(100, 32))

Bases: wx.lib.buttons.GenBitmapTextButton

DrawLabelRight(dc, width, height, dx=0, dy=0)
class CheckBox(parent, caption, call)

Bases: wx._controls.CheckBox

class ComboBox(parent, choices=None, call=None, edit=True, sort=False, first=None)

Bases: wx._controls.ComboBox

GetItemsFromData(data)
GetKey()
class Console(parent)

Bases: nabla.wx.panel.Text

FormatDict(dict, level=1)
OnConsole(event)
echo(topic=None, **kwargs)
class ConsolePanel(parent, topic='log')

Bases: nabla.wx.panel.Console

Panel para consolas.

OnLog(sub, msg=None, **kwargs)
class Empty(parent)

Bases: wx._core.Window

class FrameHelp(parent, *args, **kwargs)

Bases: wx._windows.Frame

Ventana con boton de ayuda, sirve de ejemplo para ver como se crean los wxFrame en dos pasos.

class Image(parent, id)

Bases: wx._windows.Panel

OnPaint(evt)
OnSize(event)
display(path)
class Label(*args, **kwargs)

Bases: wx._controls.StaticText

Etiqueta de texto.

SetLabel(label)
class Menu(menubar, label, items)

Bases: wx._core.Menu

class Panel(parent)

Bases: wx._windows.Panel

Hold(panel, border=0)
Visible(value=True)
class PanelBox(parent)

Bases: wx._windows.Panel

Contains(panel)
class ProgressBar(parent, color=(255, 255, 255), bgcolor=(0, 0, 0))

Bases: wx._windows.Panel

Draw(dc=None)
OnPaint(event)
OnSize(event=None)
SetValue(value)
UpdateDrawing()
class PubSubErrorPanel(parent)

Bases: nabla.wx.panel.Console

Panel para visualizar los mensajes de Pub.

OnError(sub, msg=None, **kwargs)
OnWarning(sub, msg=None, **kwargs)
class PubSubPanel(parent)

Bases: nabla.wx.panel.Console

Panel para visualizar los mensajes de Pub.

OnMessage(topic='## your listener wants topic name ## (string unlikely to be used by caller)', **kwargs)
class SizerBox(parent, title)

Bases: wx._core.StaticBoxSizer

class SizerH

Bases: wx._core.BoxSizer

class SizerRow(items)

Bases: wx._core.FlexGridSizer

class SizerTable(parent, items, expand=[], border=0)

Bases: wx._core.FlexGridSizer

class SizerV

Bases: wx._core.BoxSizer

class SizerVB(items, border=8)

Bases: wx._core.BoxSizer

class Text(parent, edit=True, multiline=False, value='', change=None, key=None, font=None, size=(32, 24), style=None)

Bases: wx._controls.TextCtrl

2.4.5. view Module

class AUIView

Bases: nabla.wx.window.MainWindow, nabla.mvc.View, nabla.wx.window.HasMenuBar, nabla.wx.window.HasToolBar, nabla.wx.window.HasImageDict, nabla.wx.window.HasAui

La Vista publica mensajes V.* a los que estᅵ suscrito el controlador.

Interface()
MenuBar()
OnClose(event=None)
OnCloseWindow(event)
OnEditor(evt)
OnEvent(event=None)
OnExit(event=None)
OnMenu(event=None)
OnSize(event=None)
OnTimer(event)
PanelCenter()
PanelLeft()
ToolBar()
box = {}
but = {}
debug = False
model = 'basic.aui'
pan = {}
wins = {}
class ConsoleView

Bases: nabla.wx.window.MainWindow, nabla.mvc.View

model = 'basic.console'

2.4.6. window Module

class FileAndTextDropTarget(file_callback, text_callback)

Bases: wx._misc.DropTarget

Drop target capable of accepting dropped files and text Assign it to a widget with .SetDropTarget @param file_callback: method @param text_callback: method

InitObjects()

Initializes the text and file data objects

OnData(x_cord, y_cord, drag_result)

Called by the framework when data is dropped on the target

class HasAui

Bases: object

MenuItemAuiPanelView(menu, label, name)
aui = {}
class HasImageDict

Bases: object

InitializeImages()
image = {}
class HasMenuBar

Bases: object

Mix para ventanas con menu.

MenuItem(menu, label='', handler=None, help='', style=0, icon=None)
nothing(event)
class HasToolBar

Bases: object

ToolItem(text=None, function=None)
class MainWindow(*args, **kwargs)

Bases: wx._windows.Frame, nabla.wx.window.HasImageDict

Clase con métodos de utilidad para incluir en la ventana principal.

AskUserForFilename(**dialogOptions)
CallWindow(window)
CreateFonts()
Debug(text)
DebugTimer(text)
Error(message, title='SMC Error')
Help(text, *args, **kwargs)
Initialize()
Message(message, title='SMC')
Mode(text)
OnAbout(evt)
Question(message, title='Pregunta')
Splash(text)
SplashCreate(image)
SplashDestroy()
Status(text=None, console=True, mode=None)
ToolIcon(tool, icon=None)
wxid = {}
class PanelWindow(win, key=None, panel=None, *args, **kwargs)

Bases: nabla.wx.window.Window

OnInit()
size = (400, 500)
class SplashScreen(image)

Bases: wx._windows.SplashScreen

Ventana de bienvenida.

OnClose(evt)
class StatusBar(parent)

Bases: wx._windows.StatusBar

Barra de estado.

OnIdle(evt)
OnSize(evt)
OnToggleOption1(event)
Reposition()
UpdateDate(format='%s %s %s')
class Window(win=None, key=None, *args, **kwargs)

Bases: wx._windows.Frame

Una clase base para ventanas auxiliares que se cierran con la aplicación. style determina el tipo. El parametro key sirve para que sea unica y no se cree otra igual: si ya estaba creada se muestra la anterior.

OnClose(event=None)
OnInit()

Metodo para inicializar.

Question(message, title='Pregunta')
Status(text, console=True)
size = (640, 480)
style = None