本文整理汇总了Python中org.eclipse.swt.widgets.Display类的典型用法代码示例。如果您正苦于以下问题:Python Display类的具体用法?Python Display怎么用?Python Display使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Display类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getImageName
def getImageName(self, image):
name = self.imageToName.get(image)
if name is not None:
return name
data = image.getImageData()
hasExcessData = data.width * data.depth / 8 < data.bytesPerLine
imageDict = self.storedImages.get((data.width, data.height), {})
for name, imgData in imageDict.items():
if self.imageDataMatches(data, imgData, hasExcessData):
baseName = os.path.basename(name)
self.imageToName[image] = baseName
return baseName
for iconId, iconName in self.systemIcons:
iconImage = Display.getCurrent().getSystemImage(iconId)
if iconImage and self.imageDataMatches(data, iconImage.getImageData(), hasExcessData):
return "system_" + iconName
for img, imgName in self.renderedImages:
if self.imageDataMatches(data, img.getImageData(), hasExcessData):
return "rendered_" + imgName
# Last chance, see if the image has been greyed out
for name, imgData in imageDict.items():
greyedImg = Image(Display.getCurrent(), Image(Display.getCurrent(), imgData), SWT.IMAGE_GRAY)
greyedData = greyedImg.getImageData()
hasGreyedExcessData = greyedData.width * greyedData.depth / 8 < greyedData.bytesPerLine
if self.imageDataMatches(data, greyedData, hasGreyedExcessData):
greyedName = os.path.basename(name) + "', 'greyed out"
self.imageToName[image] = greyedName
return greyedName
示例2: _getForeground
def _getForeground(data):
if isinstance(data,ElementInfo):
return Color(Display.getCurrent(),0,0,150)
elif isinstance(data,MetaFeatureSlot):
mv = data.getModelValue()
if mv.isElement() or mv.isElementList():
return Color(Display.getCurrent(),0,100,0)
else:
return Color(Display.getCurrent(),0,180,0)
示例3: showDialogBox
def showDialogBox(text, message):
from org.eclipse.swt.widgets import Display
from java.lang import Runnable
class ShowDialogBox(Runnable):
def __init__(self):
pass
def run(self):
m = MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING|SWT.OK)
m.setText(text)
m.setMessage(message)
m.open()
Display.getDefault().syncExec(ShowDialogBox())
示例4: getImageFromName
def getImageFromName(self,name):
if name not in self.imageMap:
try:
image = Image(Display.getCurrent(),os.path.join(self.resourcePath,name+self.extension))
except:
image = None
self.imageMap[name] = image
return self.imageMap[name]
示例5: valueChanged
def valueChanged(self, controller, newValue):
global __file_to_add__
newCount = int(newValue.getStringData());
if newCount != self.saveCount:
self.saveCount = newCount;
try:
checkFile = File(__file_name_node__.getValue().getStringData());
checkFile = File(__data_folder__ + "/" + checkFile.getName());
__file_to_add__ = checkFile.getAbsolutePath();
if not checkFile.exists():
print "The target file :" + __file_to_add__ + " can not be found";
return
runnable = __Display_Runnable__()
runnable.run = add_dataset
Display.getDefault().asyncExec(runnable)
except:
print 'failed to add dataset ' + __file_to_add__
示例6: hardwareModelIsMissingMessageBox
def hardwareModelIsMissingMessageBox(programs):
for program in programs :
if not program.getRepresenting():
msg = MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING|SWT.OK)
msg.setText("Update or generate code")
msg.setMessage("Warn : generate hardware model please.")
msg.open()
return False
return True
示例7: select_scn_file
def select_scn_file():
from org.eclipse.swt.widgets import Display, FileDialog, Shell
from org.eclipse.swt import SWT
display = Display.getDefault().getActiveShell()
shell = Shell(display)
fd = FileDialog(shell, SWT.OPEN)
fd.setText('Open')
filterExt = ['*.scn', '*.*']
fd.setFilterExtensions(filterExt)
return fd.open()
示例8: run
def run(self):
while display.isActive():
scan_id = long(display.getVar("LatestPointScanID"))
if scan_id > 0:
scanInfo = client.getScanInfo(scan_id)
statusLabel.setPropertyValue("text", scanInfo.getState().toString())
if scanInfo.getState().isActive():
scanNameLabel.setPropertyValue("text", scanInfo.getName())
commandLabel.setPropertyValue("text", scanInfo.getCurrentCommand())
progressBar.setPropertyValue("pv_value", scanInfo.getPercentage()/100.0)
# Mark scanned points as green
for i in range(table.getRowCount()):
xpos=float(table.getCellText(i, 1))
ypos=float(table.getCellText(i, 2))
if (xpos == PVUtil.getDouble(pvs[1]) and ypos==PVUtil.getDouble(pvs[2])
and scanInfo.getPercentage() >= i*100.0/table.getRowCount()): #To make sure the matched position is set from this scan
Display.getDefault().asyncExec(SetRowColor(i, ColorFontUtil.GREEN))
elif scanInfo.getState().isDone():
display.setVar("LatestPointScanID", -1)
else:
scanNameLabel.setPropertyValue("text", "None")
commandLabel.setPropertyValue("text", "")
progressBar.setPropertyValue("pv_value", 0)
Thread.sleep(1000)
示例9: run
def run(self):
while display.isActive():
scanInfos = client.server.getScanInfos()
findActive = False
markedDone = False
for scanInfo in scanInfos:
if scanInfo.getId() == long(display.getVar("LatestPointScanID")):
statusLabel.setPropertyValue("text", scanInfo.getState().toString())
if scanInfo.getState().isDone():
#mark table to dark gray if it is done.
if scanInfo.getId() == long(display.getVar("LatestPointScanID")) and not markedDone :
for i in range(table.getRowCount()):
Display.getDefault().asyncExec(SetRowColor(i, ColorFontUtil.DARK_GRAY))
markedDone=True
continue
if scanInfo.getState().isActive():
scanNameLabel.setPropertyValue("text", scanInfo.getName())
commandLabel.setPropertyValue("text", scanInfo.getCurrentCommand())
progressBar.setPropertyValue("pv_value", scanInfo.getPercentage()/100.0)
#Mark scanned points as green
if scanInfo.getId() == long(display.getVar("LatestPointScanID")):
markedDone=False
for i in range(table.getRowCount()):
xpos=float(table.getCellText(i, 1))
ypos=float(table.getCellText(i, 2))
if (xpos == PVUtil.getDouble(pvs[1]) and ypos==PVUtil.getDouble(pvs[2])
and scanInfo.getPercentage() >= i*100.0/table.getRowCount()): #To make sure the matched position is set from this scan
Display.getDefault().asyncExec(SetRowColor(i, ColorFontUtil.GREEN))
findActive=True
if not findActive:
scanNameLabel.setPropertyValue("text", "None")
commandLabel.setPropertyValue("text", "")
progressBar.setPropertyValue("pv_value", 0)
Thread.sleep(200)
示例10: __init__
def __init__(self):
childW = 500
childH = 400
parent = Display.getDefault().getActiveShell()
child = Shell(parent, SWT.CLOSE | SWT.RESIZE)
child.setMinimumSize(childW, childH)
child.setText("Advanced Search")
self._createContent(child)
parentW = parent.getBounds().width
parentH = parent.getBounds().height
parentX = parent.getBounds().x
parentY = parent.getBounds().y
child.setLocation((parentW-childW)/2+parentX, (parentH-childH)/2+parentY)
child.setSize(childW, childH)
child.open()
示例11: __init__
def __init__(self, title= None, toDisplay= None):
parentShell = Display.getDefault().getActiveShell()
self.window = Shell(parentShell, SWT.CLOSE | SWT.RESIZE)
self.window.setText(title)
self.window.setLayout(FillLayout())
self.window.setSize (self.window.computeSize(1400, 500))
self.text = Browser(self.window, SWT.NONE)
self.text.setText( \
"<html><header><style>" +
"<!--.tab { margin-left: 40px;} .tab2 { margin-left: 80px; }" +
" .tab3 { margin-left: 120px; }.tab4 { margin-left: 160px; }-->" +
"</style></header><body><div style=\"overflow: auto;\">" +
toDisplay + "</div></body></html>")
self.window.open ()
示例12: go
def go():
global display
# global variable window is org.eclipse.ui.internal.WorkbenchWindow
open_monkey_console()
display = Display.getCurrent()
runnable = MyRunnable()
if not runnable.prepare():
return
create_progress_monitor()
progress_monitor_dialog = ProgressMonitorDialog(window.getShell())
progress_monitor_dialog.run(True, True, runnable);
window.updateActionBars()
示例13: __init__
def __init__(self, url=None, html=None,title="information",width=800,height=800,labeltext=""):
parent = Display.getDefault().getActiveShell()
self.window = Shell(parent, SWT.CLOSE | SWT.RESIZE)
# give minimum size, location and size
self.window.setMinimumSize(width, height)
parentBounds = parent.getBounds()
self.window.setLocation( \
(parentBounds.width-width)/2+parentBounds.x, \
(parentBounds.height-height)/2+parentBounds.y )
self.window.setSize(width, height)
# layout
gridLayout = GridLayout(1, 1)
self.window.setLayout(gridLayout)
self.window.setText(title)
self._createLabel(labeltext)
self._createBrowser(url=url,html=html)
self._createOkButton()
self._listenSelection()
self.window.open()
示例14: runInUi
def runInUi(callable):
'''
@param callable: the callable that will be run in the UI
'''
Display.getDefault().asyncExec(RunInUi(callable))
示例15: exec
def exec(r):
display = Display.getDefault()
display.syncExec(r)
return None