本文整理汇总了Python中popup.Popup类的典型用法代码示例。如果您正苦于以下问题:Python Popup类的具体用法?Python Popup怎么用?Python Popup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Popup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_popup
def show_popup(self):
'''Show the text notification popup.'''
text = self.__msgtext.GetValue()
if text:
# Text is set, show dialog. Status of text notification.
self.__textnotif = 'show'
font = self.__data.get_sys('msg_font')
colors = self.__data.get_sys('popup_colors')
icon = os.path.join(self.__dir,
self.__data.get_sys('icon_close'))
popup = Popup(parent=self,
style=self.__bdist,
text=text,
font=font,
colors=colors,
icon=icon)
popw, poph = popup.get_size()
dispw, disph = wx.GetDisplaySize()
offx = (dispw - popw) / 2
offy = (disph - poph) / 2
popup.Position(ptOrigin=(0, 0), size=(offx, offy))
popup.Popup()
else:
# No text, no Popup, set __textnotif 'close'.
self.__textnotif = 'close'
示例2: __init__
def __init__(self, view):
Popup.__init__(self)
self.set_size_request(WIDTH, HEIGHT)
self.__view = view
sw = gtk.ScrolledWindow()
self.add(sw)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.__tree_model = gtk.ListStore(str, str, object)
self.__tree = gtk.TreeView(self.__tree_model)
self.__tree.set_headers_visible(False)
self.__tree.get_selection().connect('changed', self.__on_selection_changed)
cell = gtk.CellRendererText()
column = gtk.TreeViewColumn(None, cell, text=0)
self.__tree.append_column(column)
sw.add(self.__tree)
sw.show_all()
self.set_default_size(WIDTH, HEIGHT)
# A small amount of background shows between the scrollbar and the list;
# which looks ugly if it is the only gray thing in the window, so change
# the window background to white
self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535, 65535, 65535))
self.__doc_popup= DocPopup(fixed_width=True, fixed_height=True, max_height=HEIGHT, can_focus=False)
self._in_change = False
self.showing = False
示例3: addCategory
def addCategory(self):
pop=Popup(self.sender().text(),unicode(self.catList.currentText()))
if pop.exec_():
newCat=pop.getNewCategory()
self.cats.append(newCat)
self.catList.addItem(newCat)
self.catList.setCurrentIndex(self.catLen)
self.catLen+=1
示例4: do_map
def do_map(self):
Popup.do_map(self)
self.__view.map()
if self.focused and self.__vscrolled:
self.__scrollbar.map()
else:
# the scrollbar needs to be realized to accept the scroll events we forward it
self.__scrollbar.realize()
示例5: do_remove
def do_remove(self, child):
if child == self.__view:
self.__view = None
child.unparent()
elif child == self.__scrollbar:
self.__scrollbar = None
child.unparent
else:
Popup.do_remove(child)
示例6: do_expose_event
def do_expose_event(self, event):
Popup.do_expose_event(self, event)
if self.__can_focus and not self.focused and self.__vscrolled:
layout = self.__create_f2_layout()
width, height = layout.get_pixel_size()
cr = event.window.cairo_create()
cr.set_source_rgb(0., 0., 0.)
cr.rectangle(0, self.allocation.height - height, self.allocation.width, 1)
cr.fill()
cr.move_to(self.allocation.width - width - 5, self.allocation.height - height)
cr.show_layout(layout)
示例7: __init__
def __init__(self,parent_mode,title,width_req=0,height_req=0,
align=ALIGN.DEFAULT,
close_cb=None,
additional_formatting=True,
immediate_action=False):
Popup.__init__(self,parent_mode,title, width_req=width_req, height_req=height_req, align=align, close_cb=close_cb)
self.inputs = []
self.lines = []
self.current_input = 0
self.additional_formatting = additional_formatting
self.immediate_action = immediate_action
#We need to replicate some things in order to wrap our inputs
self.encoding = parent_mode.encoding
示例8: show_priority_popup
def show_priority_popup(self):
if self.marked:
self.popup = SelectablePopup(self,"Set File Priority",self.do_priority)
self.popup.add_line("_Do Not Download",data=deluge.common.FILE_PRIORITY["Do Not Download"])
self.popup.add_line("_Normal Priority",data=deluge.common.FILE_PRIORITY["Normal Priority"])
self.popup.add_line("_High Priority",data=deluge.common.FILE_PRIORITY["High Priority"])
self.popup.add_line("H_ighest Priority",data=deluge.common.FILE_PRIORITY["Highest Priority"])
示例9: __init__
def __init__(self, items, x, y, alwaysHighlight = False, delegate = None, *args, **kwargs):
# activestyle = tk.None suppresses the box in OS X and underline elsewhere.
defaults = {'activestyle': tk.NONE,
'borderwidth': 0,
'exportselection': False,
# Approximate the colors used in OS X:
'selectbackground': '#0950CF',
'selectforeground': '#FFF',
# Normally tk has a weird fake-3D effect - remove that.
'relief': tk.FLAT}
self._popup = Popup(x = x, y = y)
self._listbox = tk.Listbox(self._popup, *args, **dict(defaults, **kwargs))
self._listbox.pack()
self.alwaysHighlight = alwaysHighlight
self._priorSelection = None
self.delegate = delegate
self.items = items
self._listbox.bind('<<ListboxSelect>>', self._selectionChanged)
self._listbox.bind('<Return>', self.selectHighlighted)
self._listbox.bind('<Button-1>', self.selectHighlighted)
self._listbox.bind('<Enter>', self._snapHighlightToMouse)
self._listbox.bind('<Motion>', self._snapHighlightToMouse)
if not self.alwaysHighlight:
self._listbox.bind('<Leave>', self.unhighlight)
示例10: __init__
def __init__(self, frame, namespace=None):
"""
Create a Jython Console.
namespace is an optional and should be a dictionary or Map
"""
self.frame = frame
self.history = History(self)
if namespace != None:
self.locals = namespace
else:
self.locals = {}
self.buffer = [] # buffer for multi-line commands
self.interp = Interpreter(self, self.locals)
sys.stdout = StdOutRedirector(self)
self.text_pane = JTextPane(keyTyped = self.keyTyped, keyPressed = self.keyPressed)
self.__initKeyMap()
self.doc = self.text_pane.document
self.__propertiesChanged()
self.__inittext()
self.initialLocation = self.doc.createPosition(self.doc.length-1)
# Don't pass frame to popups. JWindows with null owners are not focusable
# this fixes the focus problem on Win32, but make the mouse problem worse
self.popup = Popup(None, self.text_pane)
self.tip = Tip(None)
# get fontmetrics info so we can position the popup
metrics = self.text_pane.getFontMetrics(self.text_pane.getFont())
self.dotWidth = metrics.charWidth('.')
self.textHeight = metrics.getHeight()
示例11: show_popup
def show_popup(self):
"""Show the text notification popup."""
text = self.__msgtext.GetValue()
if text:
# Text is set, show dialog. Status of text notification.
self.__textnotif = "show"
font = self.__data.get_sys("msg_font")
colors = self.__data.get_sys("popup_colors")
icon = os.path.join(self.__dir, self.__data.get_sys("icon_close"))
popup = Popup(parent=self, style=self.__bdist, text=text, font=font, colors=colors, icon=icon)
popw, poph = popup.get_size()
dispw, disph = wx.GetDisplaySize()
offx = (dispw - popw) / 2
offy = (disph - poph) / 2
popup.Position(ptOrigin=(0, 0), size=(offx, offy))
popup.Popup()
示例12: _create_popup
def _create_popup(self):
paths = []
# Open documents
paths.append(CurrentDocumentsDirectory(self._window))
doc = self._window.get_active_document()
# Current document directory
if doc and doc.is_local():
gfile = doc.get_location()
paths.append(gfile.get_parent())
# File browser root directory
if pluma.version[0] > 2 or (
pluma.version[0] == 2 and (pluma.version[1] > 26 or (pluma.version[1] == 26 and pluma.version[2] >= 2))
):
bus = self._window.get_message_bus()
try:
msg = bus.send_sync("/plugins/filebrowser", "get_root")
if msg:
uri = msg.get_value("uri")
if uri:
gfile = gio.File(uri)
if gfile.is_native():
paths.append(gfile)
except StandardError:
pass
# Recent documents
paths.append(RecentDocumentsDirectory(screen=self._window.get_screen()))
# Local bookmarks
for path in self._local_bookmarks():
paths.append(path)
# Desktop directory
desktopdir = self._desktop_dir()
if desktopdir:
paths.append(gio.File(desktopdir))
# Home directory
paths.append(gio.File(os.path.expanduser("~")))
self._popup = Popup(self._window, paths, self.on_activated)
self._popup.set_default_size(*self._plugin.get_popup_size())
self._popup.set_transient_for(self._window)
self._popup.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self._window.get_group().add_window(self._popup)
self._popup.connect("destroy", self.on_popup_destroy)
示例13: _create_popup
def _create_popup(self):
self._popup = Popup(self._window, self.on_result, self._search_func)
self._popup.set_default_size(*self._plugin.get_popup_size())
self._popup.set_transient_for(self._window)
self._popup.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self._window.get_group().add_window(self._popup)
self._popup.connect("destroy", self.on_popup_destroy)
示例14: __init__
def __init__(self, frame):
self.frame = frame # TODO do I need a reference to frame after the constructor?
self.history = History(self)
self.bs = 0 # what is this?
# command buffer
self.buffer = []
self.locals = {"gvSIG": sys.gvSIG}
self.interp = Interpreter(self, self.locals)
sys.stdout = StdOutRedirector(self)
# create a textpane
self.output = JTextPane(keyTyped=self.keyTyped, keyPressed=self.keyPressed)
# TODO rename output to textpane
# CTRL UP AND DOWN don't work
keyBindings = [
(KeyEvent.VK_ENTER, 0, "jython.enter", self.enter),
(KeyEvent.VK_DELETE, 0, "jython.delete", self.delete),
(KeyEvent.VK_HOME, 0, "jython.home", self.home),
(KeyEvent.VK_UP, 0, "jython.up", self.history.historyUp),
(KeyEvent.VK_DOWN, 0, "jython.down", self.history.historyDown),
(KeyEvent.VK_PERIOD, 0, "jython.showPopup", self.showPopup),
(KeyEvent.VK_ESCAPE, 0, "jython.hide", self.hide),
("(", 0, "jython.showTip", self.showTip),
(")", 0, "jython.hideTip", self.hideTip),
# (KeyEvent.VK_UP, InputEvent.CTRL_MASK, DefaultEditorKit.upAction, self.output.keymap.getAction(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0))),
# (KeyEvent.VK_DOWN, InputEvent.CTRL_MASK, DefaultEditorKit.downAction, self.output.keymap.getAction(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)))
]
# TODO rename newmap to keymap
newmap = JTextComponent.addKeymap("jython", self.output.keymap)
for (key, modifier, name, function) in keyBindings:
newmap.addActionForKeyStroke(KeyStroke.getKeyStroke(key, modifier), ActionDelegator(name, function))
self.output.keymap = newmap
self.doc = self.output.document
# self.panel.add(BorderLayout.CENTER, JScrollPane(self.output))
self.__propertiesChanged()
self.__inittext()
self.initialLocation = self.doc.createPosition(self.doc.length - 1)
# Don't pass frame to popups. JWindows with null owners are not focusable
# this fixes the focus problem on Win32, but make the mouse problem worse
self.popup = Popup(None, self.output)
self.tip = Tip(None)
# get fontmetrics info so we can position the popup
metrics = self.output.getFontMetrics(self.output.getFont())
self.dotWidth = metrics.charWidth(".")
self.textHeight = metrics.getHeight()
# add some handles to our objects
self.locals["console"] = self
self.caret = self.output.getCaret()
示例15: __init__
def __init__(self, fixed_height=False, fixed_width=False, max_height=MAX_HEIGHT, can_focus=True):
Popup.__init__(self)
self.__fixed_height = fixed_height
self.__fixed_width = fixed_width
self.__max_height = max_height
self.__can_focus = can_focus
self.__view = gtk.TextView()
self.__view.set_editable(False)
bg_color = gtk.gdk.Color(0xffff, 0xffff, 0xbfbf)
self.__view.modify_base(gtk.STATE_NORMAL, bg_color)
self.modify_bg(gtk.STATE_NORMAL, bg_color)
self.set_app_paintable(True)
self.__view.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color(0, 0, 0))
self.__view.set_parent(self)
self.__view.show()
self.__view.grab_focus()
global_settings.watch('doc-tooltip-font-is-custom', self.__update_font)
global_settings.watch('doc-tooltip-font-name', self.__update_font)
self.__update_font()
self.__scrollbar = gtk.VScrollbar()
self.__scrollbar.set_parent(self)
self.__scrollbar.show()
self.__view.emit('set-scroll-adjustments', None, self.__scrollbar.get_adjustment())
self.__view.connect('scroll-event', self.on_scroll_event)
self.__vscrolled = False
self.set_resizable(False)
buf = self.__view.get_buffer()
self.__bold_tag = buf.create_tag(None, weight=pango.WEIGHT_BOLD)
self.__heading_type_tag = buf.create_tag(None, weight=pango.WEIGHT_BOLD, pixels_below_lines=5)
self.__inline_type_tag = self.__bold_tag
self.__value_tag = buf.create_tag(None, family="monospace")
self.__target = None
self.focused = False
self.connect('destroy', self.on_destroy)