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


Python Toolkit.getDefaultToolkit方法代码示例

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


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

示例1: paintComponent

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
 def paintComponent(self, g2d):
     self.super__paintComponent(g2d)
     g2d.drawImage(self.surface, 0, 0, None)
     try:
         Toolkit.getDefaultToolkit().sync()
     except:
         pass
开发者ID:YuliReiri,项目名称:WinLifeGame,代码行数:9,代码来源:display.py

示例2: menuItemClicked

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
	def menuItemClicked(self, caption, messageInfo):
		msg = messageInfo[0]
		request = ''.join(map(chr, (msg.getRequest())))
		headers, body = request.split('\r\n\r\n')
		headers = dict(item.split(': ') for item in headers.split('\r\n')[1:])
		payload = ('python sqlmap.py -u "%s" --cookie="%s"' % (msg.getUrl(), headers['Cookie']))
		if body is not None and len(body) > 0: #query string is in body
			payload = '%s --data="%s"' % (payload, body)
		s = StringSelection(payload)
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,s) #put string on clipboard
		print(payload) #print string
		return
开发者ID:faffi,项目名称:scripts,代码行数:14,代码来源:sqldude.py

示例3: _build

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
	def _build(self):
		#Grab first selected message, bail if none

		iRequestInfo = self._helpers.analyzeRequest(self.ctxMenuInvocation.getSelectedMessages()[0])
		self.body = ''.join(map(chr, self.ctxMenuInvocation.getSelectedMessages()[0].getRequest())).split('\r\n\r\n')[1]
		if iRequestInfo is None:
			return 
		
		#Build payload - add your static flags here, like -s or -i
		payload = ('curl -isk ') # % (msg.getUrl()))
		#Turn all headers into dictionary, remove BLACKLISTed ones
		headers = dict(item.split(': ') for item in iRequestInfo.getHeaders()[1:])
		headers = dict( (k,v) for k, v in headers.iteritems() if k not in self.BLACKLIST )
		#print('Whitelisted Headers:\n\t' + '\n\t'.join(headers))

		#om nom cookies
		cookies = [c for c in iRequestInfo.getParameters() if c.getType() == IParameter.PARAM_COOKIE]
		#print('Found Cookies:\n\t' + '\n\t'.join([('%s=%s' % (c.getName(), c.getValue())) for c in cookies]))


		#print('DEBUG: Dumping All Parms')
		#for p in iRequestInfo.getParameters(): print ('\t%s : %s - %d' % (p.getName(), p.getValue(), p.getType()))

		#Set other command line args
		self.OPTS['-X'] = iRequestInfo.getMethod() 
		self.OPTS['-b'] = '; '.join([('%s=%s' % (c.getName(), c.getValue())) for c in cookies])

		#Add all the headers to the payload
		for k,v in headers.iteritems(): payload += '-H \'%s: %s\' \\\n' % (k, v)

		#Invoke handlers to handle content type
		#print('content type: ' + str(iRequestInfo.getContentType()))
		reqType = iRequestInfo.getContentType()
		#print("Content Type Found: %d" % reqType)
		if reqType in self.fMap:
			#print('Invoking %s' % self.fMap[reqType].func_name)
			self.fMap[reqType](iRequestInfo)

		#Add all the OPTS to the payload
		for k,v, in self.OPTS.iteritems(): payload += ('%s \'%s\' \\\n' % (k, v))

		#Append URL to end of payload
		payload += '"%s"' % iRequestInfo.getUrl().toString()
		#Nasty - invocation of some java code to get the string on the clipboard
		s = StringSelection(payload)
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,s) #put string on clipboard
		print(payload) #print string

		self.OPTS = {}
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:51,代码来源:curlit.py

示例4: getScreenPanel

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
def getScreenPanel():
    global mainScreen
    global scrPanel
    if not scrPanel:
        mainScreen = JButton()
        cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB)
        blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor")
        mainScreen.setCursor(blankCursor)
        mainScreen.setPreferredSize(
                Dimension(700, 700))
        image = BufferedImage(700, 700, BufferedImage.TYPE_INT_ARGB)
        g = image.createGraphics()
        g.setColor(Color.BLACK)
        g.fillRect(0, 0, 700, 700)
        g.setColor(Color.WHITE)
        g.setFont(Font("Serif", Font.BOLD, 20))
        g.drawString("Move your mouse here to controlfocused device.", 50, 30)
        mainScreenImg = image
        mainScreen.setIcon(swing.ImageIcon(image))

        mouseListener = ScrMouseListener()
        mainScreen.addMouseListener(mouseListener)
        mainScreen.addMouseMotionListener(mouseListener)
        mainScreen.addMouseWheelListener(mouseListener)

        mainScreen.setFocusable(True)
        keyListener = ScrKeyListener()
        mainScreen.addKeyListener(keyListener)


        scrPanel = JPanel()
        scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS))
        scrPanel.add(mainScreen)
        scrPanel.setFocusable(True)
    return scrPanel
开发者ID:sjp38,项目名称:ash,代码行数:37,代码来源:ashdi.py

示例5: __init__

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
    def __init__(self, controller):
        # Give reference to controller to delegate action response
        self.controller = controller

        # All window components apart from the menu will go in the JFrame's
        # content pane
        self.setLayout(BorderLayout())

        # Get key bindings configuration from settings
        key_strokes = self.controller.config['keystrokes']

        # Configure key bindings for undo/redo
        # First decide when key bindings can be triggered:
        condition = JComponent.WHEN_IN_FOCUSED_WINDOW

        # InputMap maps key strokes to actions in string format (e.g. 'undo')
        # ActionMap maps string actions (e.g. 'undo') with a custom
        # AbstractAction subclass.
        pane = self.getContentPane()
        for action, key in key_strokes.iteritems():
            key_stroke = KeyStroke.getKeyStroke(
                        getattr(KeyEvent, key),
                        Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())
            pane.getInputMap(condition).put(key_stroke, action)
            pane.getActionMap().put(action, KeyStrokeAction(self, action))
开发者ID:oracc,项目名称:nammu,代码行数:27,代码来源:NammuView.py

示例6: pasteHelper

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
    def pasteHelper(self):
        # import string
        # ugly work to get the text from the clipboard
        toolkit = Toolkit.getDefaultToolkit()
        clipboardContents = toolkit.getSystemClipboard().getContents(self)
        flavor = clipboardContents.getTransferDataFlavors()

        # flavor is an array of types of representations of data
        # we must find a string representation
        i = 0
        j = None
        for a in flavor:
            if clipboardContents.getTransferData(flavor[i]).__class__ == PyString:
                j = i
            i += 1

        if not j is None:
            clipboardText = clipboardContents.getTransferData(flavor[j])
            # split to remove anything after the newline, if it's multiline

            removeNewline = string.split(clipboardText, "\n")
            self.textToPaste = removeNewline[0]
        else:
            self.textToPaste = ""
            print "\a"
开发者ID:ryanms92,项目名称:mediacomp-jes,代码行数:27,代码来源:JESCommandWindow.py

示例7: connectRecord

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
 def connectRecord(self, method):               
     class EventListener(AWTEventListener):
         def eventDispatched(listenerSelf, event):
             catchAll(self.handleEvent, event, method)
 
     eventListener = EventListener()
     eventMask = AWTEvent.WINDOW_EVENT_MASK
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, eventListener, eventMask)
开发者ID:dineshkummarc,项目名称:texttest-3.22,代码行数:10,代码来源:simulator.py

示例8: startListening

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
 def startListening(self):        
     class PhysicalEventListener(AWTEventListener):
         def eventDispatched(listenerSelf, event):
             catchAll(self.handleEvent, event)
     
     self.eventListener = PhysicalEventListener()
     eventMask = AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, self.eventListener, eventMask)
开发者ID:dineshkummarc,项目名称:texttest-3.22,代码行数:10,代码来源:simulator.py

示例9: getClipboardText

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
def getClipboardText():
    """Returns the clipboard contents. Returns None if the clipboard does not
       contain text.
    """
    contents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(None)
    if contents.isDataFlavorSupported(DataFlavor.stringFlavor):
        return str(contents.getTransferData(DataFlavor.stringFlavor))
    return None
开发者ID:karlmicha,项目名称:rguils,代码行数:10,代码来源:util.py

示例10: _screenshot

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
def _screenshot(name):
    name = name.replace("<","-").replace(">","-").replace(":","-").replace("|","-").replace("*","-").replace("\"","-").replace("/","-").replace("\\","-")
    from java.awt import Toolkit,Robot,Rectangle
    from javax.imageio import ImageIO
    from java.io import File  
    screenRect = Rectangle(Toolkit.getDefaultToolkit().getScreenSize())
    capture = Robot().createScreenCapture(screenRect)
    ImageIO.write(capture, "png", File(_UXTST_OUTPUT_PATH_ + name+".png"))
开发者ID:egroise,项目名称:uxtest,代码行数:10,代码来源:uxtst.py

示例11: getClipboardText

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
 def getClipboardText(self):
     clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
     contents = clipboard.getContents(None)
     gotText = (contents != None) and contents.isDataFlavorSupported(DataFlavor.stringFlavor)
     
     if gotText:
         return contents.getTransferData(DataFlavor.stringFlavor)
     else:
         return None
开发者ID:SmeegeSec,项目名称:Burp-Importer,代码行数:11,代码来源:BurpImporter.py

示例12: getContentToPaste

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
def getContentToPaste(forComponent):
    clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
    clipContents = clipboard.getContents(forComponent)

    for flavor in clipContents.getTransferDataFlavors():
        if DataFlavor.stringFlavor.equals(flavor):
            return clipContents.getTransferData(flavor)

    return None
开发者ID:HenryStevens,项目名称:jes,代码行数:11,代码来源:pane.py

示例13: editTextComponent

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
 def editTextComponent(self, newValue, row, column):
     self.widget.runKeyword("typeIntoTableCell", row, column, newValue)
     # The above will press the Enter key and never release it, see
     # http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=197
     # We work around this by releasing it ourselves...
     releaseEvent = KeyEvent(self.widget.widget,
                             KeyEvent.KEY_RELEASED, System.currentTimeMillis(),
                             0, KeyEvent.VK_ENTER)
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent, releaseEvent)
开发者ID:dineshkummarc,项目名称:texttest-3.22,代码行数:11,代码来源:simulator.py

示例14: main

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
def main():
    load('bookshelf.conf')
    if config('LOCALE') is not None and config('LOCALE') != '':
        Locale.setDefault(Locale(config('LOCALE')))
    from window import BookshelfView
    from logic import Bookshelf
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    view = BookshelfView(Bookshelf())
    screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    view.setLocation(screenSize.width/5,  screenSize.height/5)
    view.setVisible(1)
开发者ID:ak1394,项目名称:bookshelf,代码行数:13,代码来源:application.py

示例15: pasteAction

# 需要导入模块: from java.awt import Toolkit [as 别名]
# 或者: from java.awt.Toolkit import getDefaultToolkit [as 别名]
    def pasteAction(self, event=None):
        if self.inLastLine():
            clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
            clipboard.getContents(self.textpane)
            contents = clipboard.getData(DataFlavor.stringFlavor)

            lines = contents.splitlines()
            for i, line in enumerate(lines):
                self.insertText(line)
                if i < len(lines) - 1:
                    self.enterAction()
开发者ID:kingfs,项目名称:jython-burp-api,代码行数:13,代码来源:console.py


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