当前位置: 首页>>代码示例>>Python>>正文


Python Display.getCurrent方法代码示例

本文整理汇总了Python中org.eclipse.swt.widgets.Display.getCurrent方法的典型用法代码示例。如果您正苦于以下问题:Python Display.getCurrent方法的具体用法?Python Display.getCurrent怎么用?Python Display.getCurrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Display的用法示例。


在下文中一共展示了Display.getCurrent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getImageName

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
    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
开发者ID:gbtami,项目名称:storytext,代码行数:31,代码来源:describer.py

示例2: _getForeground

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
 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)      
开发者ID:escribis,项目名称:.modelio,代码行数:11,代码来源:introspection.py

示例3: getImageFromName

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
 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]
开发者ID:escribis,项目名称:.modelio,代码行数:10,代码来源:misc.py

示例4: hardwareModelIsMissingMessageBox

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
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
开发者ID:juniper-project,项目名称:modelling-environment,代码行数:11,代码来源:updateAndGenerateCode.py

示例5: go

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
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()
开发者ID:miohtama,项目名称:mfabrik.scanner,代码行数:20,代码来源:import_src.py

示例6: MyROIInfoProvider

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
class MyROIInfoProvider(IROIInfoProvider):
    '''Provide custom information for ROI.
    '''
    def getROIInfo(self, xIndex, yIndex, width, height):
        return name + "(" + str(xIndex) + ", " + str(yIndex) + " )"
        
class MyROIListener(IROIListener):
    '''Listener on ROI updates.
    '''
    def roiUpdated(self, xIndex, yIndex, width, height):
        roiXPV.setValue(xIndex)
        roiYPV.setValue(yIndex)
        roiWPV.setValue(width)
        roiHPV.setValue(height)

currentDisplay = Display.getCurrent()
class UpdateROIUITask(Runnable):
	def run(self):
		#this method must be called in UI thread
		intensityGraph.setROIDataBounds(name, PVUtil.getLong(roiXPV), PVUtil.getLong(roiYPV), PVUtil.getLong(roiWPV),PVUtil.getLong(roiHPV))
		
class UpdateROIFromPVListener(PVListener):
	'''Update the ROI while ROI PV value updated'''
	def pvValueUpdate(self, pv):
		currentDisplay.asyncExec(UpdateROIUITask())

intensityGraph.addROI(name, MyROIListener(), MyROIInfoProvider())

roiXPV.addListener(UpdateROIFromPVListener())
roiYPV.addListener(UpdateROIFromPVListener())
roiWPV.addListener(UpdateROIFromPVListener())
开发者ID:Crisam,项目名称:cs-studio,代码行数:33,代码来源:addROI.py

示例7: MessageBox

# 需要导入模块: from org.eclipse.swt.widgets import Display [as 别名]
# 或者: from org.eclipse.swt.widgets.Display import getCurrent [as 别名]
try:
    input_path = input_path_parameter
except NameError:
    input_path = '/media/sf_Dropbox/Projects/JUNIPER/WP5/libdag/xml/taskset.xml'

import subprocess
try:
    output = subprocess.check_output([dag_path, input_path])
except CalledProcessError as e:
    output = e.output
    
    from org.eclipse.swt.widgets import MessageBox
    from org.eclipse.swt.widgets import Display
    from org.eclipse.swt import SWT
    
    m = MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR|SWT.OK)
    m.setText("JuniperIDE")
    m.setMessage("Error running Schedulability analyser!")
    m.open()
    
from tempfile import NamedTemporaryFile
output_file = NamedTemporaryFile(delete=False)
output_file.write(output)
output_file.close()

from org.modelio.api.modelio import Modelio
from org.modelio.api.editor import EditorType
from java.io import File
Modelio.getInstance().getEditionService().openEditor(selectedElements.get(0), File(output_file.name), EditorType.TXTEditor, True)

import os
开发者ID:juniper-project,项目名称:modelling-environment,代码行数:33,代码来源:runDag.py


注:本文中的org.eclipse.swt.widgets.Display.getCurrent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。