本文整理汇总了Python中pyjamas.ui.Image.Image.addClickListener方法的典型用法代码示例。如果您正苦于以下问题:Python Image.addClickListener方法的具体用法?Python Image.addClickListener怎么用?Python Image.addClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Image.Image
的用法示例。
在下文中一共展示了Image.addClickListener方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh_theorems
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
def refresh_theorems(self, folder):
self.remove_images()
def onClick(theorem):
def name(n):
return "var" + str(n + 1)
def print_scheme(n):
return ["\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon"][n]
def poas(sender):
if len(theorem.operations) == 1:
constants = [Operation("const" + str(i + 1), 0, print_scheme(i), name(i), Operation.EXPRESSION)
for i in range(theorem.operations[0].no_of_args)]
def after1(f):
self.after(
theorem.formula.substitute_definition(Formula([theorem.operations[0]] + constants), f),
predecessors=[], rule_name="insert")
request_formula([op for op in proof.get_operations()] + constants,
after1, type=('rel' if theorem.operations[0].type == Operation.RELATION else 'exp'))
else:
self.after(theorem.formula, predecessors=[], rule_name="insert")
return poas
for ax in [x for x in Theorem.theorems if x.folder == folder]:
im = Image()
im.addClickListener(onClick(ax))
im.setUrl(latex_to_url(ax.formula.to_latex()))
self.pok.add(im)
self.images.append(im)
示例2: MechDrawing
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
class MechDrawing(VerticalPanel):
def __init__(self, handle, idx, image, variables = None, code = None,
perspective = '', checkOptions = [False, True]):
VerticalPanel.__init__(self)
self._handle = handle
self.idx = idx
# set style
self.setStyleName('os-mech-drawing')
# create widgets
self._img = Image(image)
self._img.setStyleName('os-mech-thumb')
self._img.addClickListener(self.onClickDrawing)
self._perspective = '%d - %s'%(idx, perspective.capitalize())
self._optionPanel = MechOptionPanel(handle, idx, checkOptions)
textArea = TextArea(code)
textArea.setText(code)
textArea.setStyleName('os-mech-code-locked')
textArea.setReadonly(self, True)
# populate drawing
self.add(self._img)
self.add(self._optionPanel)
self.add(textArea)
def actRatioChange(self, ratio):
self._optionPanel.actRatioChange(ratio)
def onClickDrawing(self, sender, event):
Window.open(self._img.getUrl() + '&render=html&title=%s'%self._perspective, self._perspective, "status=1,resizeable=1,scrollbars=1")
示例3: Images
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
class Images(Sink):
def __init__(self):
Sink.__init__(self)
self.curImage=0
self.image=Image()
self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"]
for i in range(len(self.sImages)):
self.sImages[i]=self.baseURL() + self.sImages[i]
self.image.addLoadListener(self)
self.prevButton.addClickListener(self)
self.nextButton.addClickListener(self)
topPanel = DockPanel()
topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
topPanel.add(self.prevButton, DockPanel.WEST)
topPanel.add(self.nextButton, DockPanel.EAST)
topPanel.add(self.loadingImage, DockPanel.CENTER)
panel = VerticalPanel()
panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
panel.add(topPanel)
panel.add(self.image)
panel.setWidth("100%")
self.initWidget(panel)
self.image.setStyleName("ks-images-Image")
self.nextButton.setStyleName("ks-images-Button")
self.prevButton.setStyleName("ks-images-Button")
self.loadImage(0)
def onClick(self, sender):
if sender==self.prevButton:
self.loadImage(self.curImage - 1)
elif sender == self.nextButton:
self.loadImage(self.curImage + 1)
def onError(self, sender):
pass
def onLoad(self, sender=None):
self.loadingImage.setUrl(self.baseURL() + "images/blanksearching.gif")
def loadImage(self, index):
if index < 0:
index = len(self.sImages) - 1
elif index > len(self.sImages) - 1:
index = 0
self.curImage = index
self.loadingImage.setUrl(self.baseURL() + "images/searching.gif")
self.image.setUrl(self.sImages[self.curImage])
示例4: __init__
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
def __init__(self):
SimplePanel.__init__(self)
# We display the "myImage.jpg" file, stored in the "public/images"
# directory, where "public" is in the application's source directory.
img = Image("images/myImage.jpg")
img.addClickListener(getattr(self, "onImageClicked"))
self.add(img)
示例5: make_footer
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
def make_footer(self):
self.time = {}
self.time['hour'] = ListBox()
self.time['hour'].setVisibleItemCount(1)
for hour in range(24):
self.time['hour'].addItem('%02d' % hour)
self.time['hour'].setSelectedIndex(12)
self.time['minute'] = ListBox()
self.time['minute'].setVisibleItemCount(1)
for minute in range(0, 60, 5):
self.time['minute'].addItem('%02d' % minute)
self.time['minute'].setSelectedIndex(0)
time_panel = HorizontalPanel()
time_panel.setVerticalAlignment('center')
time_panel.add(self.time['hour'])
time_panel.add(Label(':'))
time_panel.add(self.time['minute'])
self.table.setWidget(1, 0, time_panel)
weekdays_panel = HorizontalPanel()
weekdays_panel.setSpacing(5)
self.weekdays = {}
for i in range(7):
self.weekdays[i] = CheckBox(AlarmWidget.weekday_name[i])
self.weekdays[i].setChecked(i < 6)
weekdays_panel.add(self.weekdays[i])
self.table.setWidget(1, 1, weekdays_panel)
self.duration = ListBox()
self.duration.setVisibleItemCount(1)
choices = [ 1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60 ]
for seconds in choices:
self.duration.addItem(
'%ds' % seconds if seconds < 60 else '%dm' % (seconds / 60),
seconds)
self.duration.setSelectedIndex(2)
self.table.setWidget(1, 2, self.duration)
image = Image('icons/plus.png')
image.setTitle('add');
image.addClickListener(self.plus_clicked)
self.table.setWidget(1, 3, image)
for col in range(4):
self.table.getCellFormatter().setStyleName(1, col, 'tablecell noborder')
示例6: PrettyTab
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
class PrettyTab(Composite):
def __init__(self, text, imageUrl):
DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)
p = HorizontalPanel()
p.setSpacing(3)
self.img = Image(imageUrl)
self.txt = HTML(text)
p.add(self.img)
p.add(self.txt)
self.add(p)
def addClickListener(self, listener):
self.img.addClickListener(listener)
self.txt.addClickListener(listener)
示例7: add
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
def add(self, time, weekdays=range(5), duration=3):
row = self.table.getRowCount()-1
self.table.insertRow(row)
self.table.setText(row, 0, time)
weekdays_str = []
for weekday in weekdays:
weekdays_str.append(AlarmWidget.weekday_name[weekday])
self.table.setText(row, 1, ', '.join(weekdays_str))
self.table.setText(row, 2, str(duration) + 's')
image = Image('icons/x.png')
image.setTitle('delete');
image.addClickListener(lambda x: self.x_clicked(row-1))
self.table.setWidget(row, 3, image)
for col in range(3):
self.table.getCellFormatter().setStyleName(row, col, 'tablecell')
self.table.getCellFormatter().setStyleName(row, 3, 'tablecell noborder')
示例8: draw
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
def draw(self):
paramPanel = HorizontalPanel(Width='100%', VerticalAlignment='middle')
options = self.drawOptions()
label = Label(self.kind['item'], StyleName='aur-search-advanced-param-title')
delSelf = Image(url='/ico/cross.png', Title='Delete this parameter')
delSelf.addStyleName('aur-search-advanced-delete')
if self.kind['allowsInverse']:
invertSelf = Image(url='/ico/exclamation.png', Title='Invert this parameter')
invertSelf.addClickListener(getattr(self, 'invertSelf'))
else:
invertSelf = Image(url='/ico/bullet_white.png', StyleName='aur-search-advanced-placeholder')
self.container.add(self.panel)
self.panel.setWidget(paramPanel)
paramPanel.add(delSelf)
paramPanel.add(label)
paramPanel.add(options)
paramPanel.add(invertSelf)
paramPanel.setCellWidth(delSelf, '1px')
paramPanel.setCellWidth(options, '1px')
paramPanel.setCellWidth(invertSelf, '1px')
delSelf.addClickListener(getattr(self, 'delSelf'))
示例9: onModuleLoad
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
def onModuleLoad(self):
self.popupsubtraca = PopupSub(id="sub",datasrc="fsubtracao.pjs")
self.popupsoma = PopupSoma(id="soma",datasrc="fsoma.pjs")
self.popupmultescalar = PopupEscalar(id="escalar",datasrc="fmultescalar.pjs")
self.popupmult = PopupProduto(id="mult",datasrc="fmult.pjs")
self.popupsoma.iniciado = False;
tabpanel = TabPanel()
grid = Grid(4,2)
imgbtnSoma = Image("images/Soma_Matriz_sum_matrix.png",StyleName="gwt-ImageButton")
imgbtnSubtracao = Image("images/subtracao_Matriz_subtract_matrix.png",StyleName="gwt-ImageButton")
imgbtnMultiplicacao = Image("images/multiplicacao_Matriz_product_matrix.png",StyleName="gwt-ImageButton")
imgbtnMultiplicacaoPorEscalar = Image("images/multiplicacao_por_escalar.png",StyleName="gwt-ImageButton")
#eventos
imgbtnSoma.addClickListener(self.onSomaButtonClick)
imgbtnSubtracao.addClickListener(self.onSubtracaoButtonClick)
imgbtnMultiplicacao.addClickListener(self.onMultiplicacaoButtonClick)
imgbtnMultiplicacaoPorEscalar.addClickListener(self.onMulPorEscalarButtonClick)
contents = VerticalPanel()
contents.setSpacing(4)
contents.add(HTML('You can place any contents you like in a dialog box.'))
grid.setWidget(0,0,imgbtnSoma)
grid.setWidget(0,1,imgbtnSubtracao)
grid.setWidget(2,0,imgbtnMultiplicacao)
grid.setWidget(2,1,imgbtnMultiplicacaoPorEscalar)
grid.setStyleName(element)
tabpanel.add(HTML("Modulo de introducao a matrizes"),"<h2>Modulo de introducao a Matrizes</h2>", True)
tabpanel.add(grid,"<h2> Matrizes </h2>", True)
tabpanel.add(HTML("Modulo de introducao a matrizes"),"<h2>Ajuda para usar a ferramenta</h2>", True)
tabpanel.setSize("90%"," 70%")
tabpanel.selectTab(1)
#self.popupsoma.show()
RootPanel("conteudo").add(tabpanel)
示例10: DialogWindow
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
class DialogWindow(DialogBox):
_props = [
("caption", "Caption", "HTML", None),
]
def __init__(self, autoHide=None, modal=True, centered=False,
caption=None, minimize=None, maximize=None, close=None,
captionStyle=None,
**kwargs):
# Init section
DialogBox.__init__(self, autoHide, modal, centered, **kwargs)
self._dialogListeners = []
self._minimized = None
self._maximized = None
# Arguments section
if isinstance(caption, basestring):
self.caption.setText(caption)
elif caption is not None:
self.caption = caption
self.caption.addMouseListener(self)
if captionStyle is not None:
self.caption.setStyleName(captionStyle)
else:
self.caption.addStyleName('WindowCaption')
self.setControls(minimize, maximize, close)
def createDefaultControl(self, control_type):
if control_type == 'minimize':
return Button("_")
elif control_type == 'maximize':
return Button("^")
elif control_type == 'close':
return Button("X")
raise ValueError("Invalid control '%s'" % control_type)
def setControls(self, minimize, maximize, close):
if minimize is True:
self.minimizeWidget = self.createDefaultControl('minimize')
elif isinstance(minimize, basestring):
self.minimizeWidget = Image(minimize)
else:
self.minimizeWidget = minimize
if maximize is True:
self.maximizeWidget = self.createDefaultControl('maximize')
elif isinstance(maximize, basestring):
self.maximizeWidget = Image(maximize)
else:
self.maximizeWidget = maximize
if close is True:
self.closeWidget = self.createDefaultControl('close')
elif isinstance(close, basestring):
self.closeWidget = Image(close)
else:
self.closeWidget = close
if (isinstance(self.minimizeWidget, UIObject) or
isinstance(self.maximizeWidget, UIObject) or
isinstance(self.closeWidget, UIObject)):
cf = self.panel.getCellFormatter()
captionStyle = self.caption.getStyleName()
captionPanel = FlexTable(
Width="99%",
BorderWidth="0",
CellPadding="0",
CellSpacing="0",
)
controls = HorizontalPanel()
controls.setStyleName("Controls")
controls.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
if isinstance(self.minimizeWidget, UIObject):
self.minimizeWidget.setStyleName("Minimize")
controls.add(self.minimizeWidget)
self.minimizeWidget.addClickListener(
getattr(self, "onMinimize"),
)
if isinstance(self.maximizeWidget, UIObject):
self.maximizeWidget.setStyleName("Maximize")
controls.add(self.maximizeWidget)
self.maximizeWidget.addClickListener(
getattr(self, "onMaximize"),
)
if isinstance(self.closeWidget, UIObject):
self.closeWidget.setStyleName("Close")
controls.add(self.closeWidget)
self.closeWidget.addClickListener(
getattr(self, "onClose"),
)
self.closeable = True
self.caption.removeStyleName(captionStyle)
self.panel.setWidget(0, 0, captionPanel)
captionPanel.setWidget(0, 0, self.caption)
captionPanel.setWidget(0, 1, controls)
captionPanel.setStyleName(captionStyle)
cf = captionPanel.getCellFormatter()
cf.setWidth(0, 1, '1%')
def getDialogListeners(self, listener):
return self._dialogListeners
def addDialogListener(self, listener):
#.........这里部分代码省略.........
示例11: PopupPagina
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
#.........这里部分代码省略.........
lblinha1.addItem("5", value=5)
lblinha2 = ListBox()
lblinha2.setID("lm2")
lblinha2.addItem("1", value=1)
lblinha2.addItem("2", value=2)
lblinha2.addItem("3", value=3)
lblinha2.addItem("4", value=4)
lblinha2.addItem("5", value=5)
lbcoluna1 = ListBox()
lbcoluna1.setID("cm1")
lbcoluna1.addItem("1", value=1)
lbcoluna1.addItem("2", value=2)
lbcoluna1.addItem("3", value=3)
lbcoluna1.addItem("4", value=4)
lbcoluna1.addItem("5", value=5)
lbcoluna1.addItem("6", value=6)
lbcoluna1.addItem("7", value=7)
lbcoluna2 = ListBox()
lbcoluna2.setID("cm2")
lbcoluna2.addItem("1", value=1)
lbcoluna2.addItem("2", value=2)
lbcoluna2.addItem("3", value=3)
lbcoluna2.addItem("4", value=4)
lbcoluna2.addItem("5", value=5)
lbcoluna2.addItem("6", value=6)
lbcoluna2.addItem("7", value=7)
self.lblStatus = Label("Label para Status")
# Eventos
self.imageFechar.addClickListener(self.onFecharPopup)
# Cabeçalho da poupPanel
self.grid = Grid(1, 16)
self.grid.setWidth(self.getWidth())
self.grid.setHTML(0, 0, "<b>Matriz 1:</b> Nº Linhas:")
self.grid.setWidget(0, 1, lblinha1)
self.grid.setText(0, 2, "Nº Colunas:")
self.grid.setWidget(0, 3, lbcoluna1)
self.grid.setHTML(0, 4, "<b>Matriz 2:</b> Nº Linhas:")
self.grid.setWidget(0, 5, lblinha2)
self.grid.setText(0, 6, "Nº Colunas:")
self.grid.setWidget(0, 7, lbcoluna2)
# self.grid.setWidget(0, 3, self.txtColunas)
self.grid.setWidget(0, 8, self.btnStepByStep)
self.grid.setWidget(0, 9, self.btnDesfazer)
self.grid.setWidget(0, 10, self.btnFazer)
self.grid.setHTML(0, 11, "<b>Velocidade:</b>")
self.grid.setWidget(0, 12, self.lbVelocidade)
self.grid.setWidget(0, 13, self.btnAutomatic)
# self.grid.setWidget(0, 14, self.btnInterativo)
self.grid.setWidget(0, 15, self.imageFechar)
# self.grid.setWidget(0, 7, self.btnFechar)
self.grid.getCellFormatter().setAlignment(
0, 15, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_TOP
)
self.panel = FlexTable(Height="100%", width="100%", BorderWidth="0", CellPadding="0", CellSpacing="0")
self.panel.setWidget(0, 0, self.caption)
self.panel.setWidget(1, 0, self.grid)
self.panel.getCellFormatter().setHeight(2, 0, "100%")
self.panel.getCellFormatter().setWidth(2, 0, "100%")
示例12: DialogBoxModal
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
class DialogBoxModal(PopupPanel):
def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None):
PopupPanel.__init__(self, autoHide, modal, rootpanel)
self.identifier = identifier
self.caption = HTML()
self.child = None
self.showing = False
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable()
self.closeButton = Image('cancel.png')
self.closeButton.addClickListener(self)
dock = DockPanel()
dock.setSpacing(0)
dock.add(self.closeButton, DockPanel.EAST)
dock.add(self.caption, DockPanel.WEST)
dock.setCellHorizontalAlignment(self.closeButton,
HasAlignment.ALIGN_RIGHT)
dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
dock.setCellWidth(self.caption, '100%')
dock.setWidth('100%')
self.panel.setWidget(0, 0, dock)
self.panel.setHeight('100%')
self.panel.setBorderWidth(0)
self.panel.setCellPadding(0)
self.panel.setCellSpacing(0)
self.panel.getCellFormatter().setHeight(1, 0, '100%')
self.panel.getCellFormatter().setWidth(1, 0, '100%')
#self.panel.getCellFormatter().setAlignment(1, 0,
# HasHorizontalAlignment.ALIGN_CENTER,
# HasVerticalAlignment.ALIGN_MIDDLE)
PopupPanel.setWidget(self, self.panel)
self.setStyleName('gwt-DialogBox')
self.caption.setStyleName('Caption')
self.closeButton.setStyleName('Close')
dock.setStyleName('Header')
self.caption.addMouseListener(self)
def getHTML(self):
return self.caption.getHTML()
def getText(self):
return self.caption.getText()
def onMouseDown(self, sender, x, y):
self.dragging = True
DOM.setCapture(self.caption.getElement())
self.dragStartX = x
self.dragStartY = y
def onMouseEnter(self, sender):
pass
def onMouseLeave(self, sender):
pass
def onMouseMove(self, sender, x, y):
if self.dragging:
absX = x + self.getAbsoluteLeft()
absY = y + self.getAbsoluteTop()
self.setPopupPosition(absX - self.dragStartX,
absY - self.dragStartY)
def onMouseUp(self, sender, x, y):
self.dragging = False
DOM.releaseCapture(self.caption.getElement())
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
self.child = None
return True
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def doAttachChildren(self):
PopupPanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
PopupPanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
self.panel.remove(self.child)
#.........这里部分代码省略.........
示例13: CollapserPanel
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addClickListener [as 别名]
class CollapserPanel(SimplePanel):
def __init__(self, sink):
SimplePanel.__init__(self)
self.sink = sink
self.caption = HTML()
self.child = None
self.showing = False
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable()
self.collapse = Image("./images/cancel.png")
self.collapse.addClickListener(self)
dock = DockPanel()
dock.setSpacing(0)
dock.add(self.collapse, DockPanel.EAST)
dock.add(self.caption, DockPanel.WEST)
dock.setCellHorizontalAlignment(self.collapse, HasAlignment.ALIGN_RIGHT)
dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP)
dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
dock.setCellWidth(self.caption, "100%")
dock.setWidth("100%")
dock.setHeight("100%")
self.panel.setWidget(0, 0, dock)
self.panel.setHeight("100%")
self.panel.setWidth("100%")
self.panel.setBorderWidth(0)
self.panel.setCellPadding(0)
self.panel.setCellSpacing(0)
self.panel.getCellFormatter().setHeight(1, 0, "100%")
self.panel.getCellFormatter().setWidth(1, 0, "100%")
self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP)
SimplePanel.setWidget(self, self.panel)
self.setStyleName("gwt-DialogBox")
self.caption.setStyleName("Caption")
self.collapse.setStyleName("Close")
dock.setStyleName("Header")
#self.caption.addMouseListener(self)
self.collapsed = False
self.collapsed_width = "15px"
self.uncollapsed_width = "100%"
def setInitialWidth(self, width):
self.uncollapsed_width = width
SimplePanel.setWidth(self, width)
self.sink.setCollapserWidth(self, width)
def setHeight(self, height):
SimplePanel.setHeight(self, height)
def onClick(self, sender):
if self.collapsed == False:
self.collapse.setUrl("./tree_closed.gif")
self.collapsed = True
self.caption.setVisible(False)
if self.child:
self.child.setVisible(False)
self.setWidth(self.collapsed_width)
self.sink.setCollapserWidth(self, self.collapsed_width)
else:
self.collapse.setUrl("./images/cancel.png")
self.collapsed = False
self.caption.setVisible(True)
if self.child:
self.child.setVisible(True)
self.setWidth(self.uncollapsed_width)
self.sink.setCollapserWidth(self, self.uncollapsed_width)
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
return True
def doAttachChildren(self):
SimplePanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
SimplePanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
self.panel.remove(self.child)
if widget is not None:
#.........这里部分代码省略.........