本文整理汇总了Python中pyjamas.ui.Image.Image类的典型用法代码示例。如果您正苦于以下问题:Python Image类的具体用法?Python Image怎么用?Python Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: MechDrawing
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: refresh_theorems
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)
示例4: __init__
def __init__(self):
Algorithm.__init__(self)
self.MLAlgorithmService = MLAlgorithmService(self)
self.image=Image(self.baseURL() + "services/kMeansPictures/lenna.png",Width="320px", Height="360px")
self.resultImage=Image("",Width="320px", Height="360px")
self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
self.calculateButton = Button("RUN", self.onButtonClick)
self.log = Button("SHOW LOG", self.openLogFile)
self.log.setEnabled(False)
self.image.addLoadListener(self)
topPanel = DockPanel()
topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
topPanel.add(self.calculateButton, DockPanel.WEST)
topPanel.add(self.loadingImage, DockPanel.CENTER)
topPanel.add(self.log, DockPanel.EAST)
panel = DockPanel()
panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
#panel.add(HTML("<h2>Image compression</h2>", True))
panel.add(topPanel, DockPanel.NORTH)
panel.add(self.image, DockPanel.WEST)
panel.add(self.resultImage, DockPanel.EAST)
panel.setWidth("100%")
self.initWidget(panel)
self.image.setStyleName("ks-images-Image")
self.calculateButton.setStyleName("ks-images-Button")
self.loadImage("picturem.png")
示例5: addToggleButton
def addToggleButton(self, panel, imagep, tip):
img = Image(imagep)
img.setWidth("20px")
img.setHeight("20px")
tb = ToggleButton(img)
self.addAnyButton(panel, tb, tip)
return tb
示例6: setControls
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%')
示例7: __init__
def __init__(self, no, up_img, down_img):
self.x = 0
self.y = 0
self.no = no
self.up_img = up_img
self.down_img = down_img
Image.__init__(self, up_img)
self.setStyleName("gwt-Image-Cell")
示例8: addPushButton
def addPushButton(self, panel, imagep, tip):
img = Image(imagep)
img.setWidth("20px")
img.setHeight("20px")
pb = PushButton(img)
self.addAnyButton(panel, pb, tip)
return pb
示例9: __init__
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)
示例10: createImage
def createImage(self, imageUrl):
image = Image(imageUrl)
image.setStyleName("ks-images-Image")
p = VerticalPanel()
p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
p.add(image)
return p
示例11: prepareImage
def prepareImage(self, url):
img = Image()
img.__isLoaded = False
img.addLoadListener(self)
# normally, event listeners are only set up when the widget
# is attached to part of the DOM (see Widget.onAttach). but,
# in this case, we want a load even _even though_ the Image
# widget is not yet attached (and quite likely won't be).
DOM.setEventListener(img.getElement(), img)
return img
示例12: add_formula
def add_formula(self, f):
h = HorizontalPanel()
im = Image()
im.setUrl(latex_to_url(f.to_latex()))
c = CheckBox()
h.add(c)
h.add(im)
self.pok.add(h)
self.checkbox_list.append(c)
self.hpanel_list.append(h)
self.image_list.append(im)
示例13: FormulaBuilder
class FormulaBuilder(DialogWindow):
def __init__(self, operations,after,type='rel'):
DialogWindow.__init__(self, modal=True, close=True)
self.formula = Formula([])
self.after=after
left = 100
top = 100
self.ops_with_buttons = [{"op": op, "button": Button(op.name, self)} for op in operations if op.available]
dock = DockPanel()
dock.setSpacing(3)
for owb in self.ops_with_buttons:
dock.add(owb['button'], DockPanel.NORTH)
dock.setWidth("300")
self.image = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
dock.add(self.image, DockPanel.EAST)
dock.setCellHorizontalAlignment(self.image, HasAlignment.ALIGN_TOP)
self.doneButton=Button("Done",self)
self.doneButton.setEnabled(False)
dock.add(self.doneButton,DockPanel.SOUTH)
dock.add(HTML(""),DockPanel.CENTER)
self.setText("opkop")
self.setPopupPosition(left, top)
self.setStyleAttribute("background-color", "#ffffff")
self.setStyleAttribute("color", "blue")
self.setStyleAttribute("border-width", "5px")
self.setStyleAttribute("border-style", "solid")
self.setWidget(dock)
def onClick(self, sender):
if sender==self.doneButton:
self.hide()
self.after(self.formula)
op=None
for owb in self.ops_with_buttons:
if owb['button'] == sender:
self.setText(sender.getText())
op=owb['op']
if not self.formula.is_closed():
self.formula.add_one_op(op,type)
self.image.setUrl(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
if self.formula.is_closed():
self.doneButton.setEnabled(True)
示例14: make_footer
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')
示例15: __init__
def __init__(self, userListPanel, tabPanel, topPanel):
VerticalPanel.__init__(self, StyleName='large-avatar-panel')
self.userListPanel = userListPanel
self.tabPanel = tabPanel
self.topPanel = topPanel
upperPanel = HorizontalPanel(StyleName='large-avatar-upper-panel',
Spacing=8)
self.image = Image(StyleName='large-avatar')
self.upperText = HTML(StyleName='large-avatar-upper-text')
upperPanel.add(self.image)
upperPanel.add(self.upperText)
self.add(upperPanel)
self.lowerText = HTML(StyleName='large-avatar-lower-text')
self.add(self.lowerText)
self.followButton = None
self.user = None
insertPanel = HorizontalPanel(Spacing=3)
insertPanel.add(Label('Use name: '))
if tabPanel.tabName == 'simple':
b1 = Button('upper', SimpleInserter(self, 'upper'))
b2 = Button('lower', SimpleInserter(self, 'lower'))
insertPanel.add(b1)
insertPanel.add(b2)
else:
b1 = Button('or', QueryInserter(self, 'or'))
b2 = Button('and', QueryInserter(self, 'and'))
b3 = Button('except', QueryInserter(self, 'except'))
insertPanel.add(b1)
insertPanel.add(b2)
insertPanel.add(b3)
self.add(insertPanel)