Esempio n. 1
0
def _get_file_name(panel, title, filters):
    panel.setCanChooseFiles_(True)
    panel.setCanChooseDirectories_(False)
    panel.setAllowsMultipleSelection_(False)
    panel.setTitle_(get_NSString(title))
    
    filters = [get_NSString(f[1][2:]) for f in filters]
    panel.setAllowedFileTypes_(_get_nsarray(filters))
    if panel.runModal():
        return cfstring_to_string(panel.URL().path())
Esempio n. 2
0
 def set_mouse_position(self, x, y, absolute=False):
     if absolute:
         # If absolute, then x, y is given in global display coordinates
         # which sets (0,0) at top left corner of main display.  It is possible
         # to warp the mouse position to a point inside of another display.
         quartz.CGWarpMouseCursorPosition(CGPoint(x,y))
     else:
         # Window-relative coordinates: (x, y) are given in window coords
         # with (0,0) at bottom-left corner of window and y up.  We find
         # which display the window is in and then convert x, y into local
         # display coords where (0,0) is now top-left of display and y down.
         screenInfo = self._nswindow.screen().deviceDescription()
         displayID = screenInfo.objectForKey_(cocoapy.get_NSString('NSScreenNumber'))
         displayID = displayID.intValue()
         displayBounds = quartz.CGDisplayBounds(displayID)
         frame = self._nswindow.frame()
         windowOrigin = frame.origin
         x += windowOrigin.x
         y = displayBounds.size.height - windowOrigin.y - y
         quartz.CGDisplayMoveCursorToPoint(displayID, cocoapy.NSPoint(x, y))
Esempio n. 3
0
 def set_caption(self, caption):
     self._caption = caption
     if self._nswindow is not None:
         self._nswindow.setTitle_(cocoapy.get_NSString(caption))
Esempio n. 4
0
def _notify(title, msg):
    notification = NSUserNotification.alloc().init().autorelease()
    notification.setTitle_(get_NSString(title))
    notification.setInformativeText_(get_NSString(msg))
    notificationCenter.deliverNotification_(notification)
Esempio n. 5
0
def _notify(title, msg):
    notification = NSUserNotification.alloc().init().autorelease()
    notification.setTitle_(get_NSString(title))
    notification.setInformativeText_(get_NSString(msg))
    notificationCenter.deliverNotification_(notification)