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


Python dialogs.Dialog类代码示例

本文整理汇总了Python中dialogs.Dialog的典型用法代码示例。如果您正苦于以下问题:Python Dialog类的具体用法?Python Dialog怎么用?Python Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, title, items, **kwds):
     self.title = title
     self.items = items
     self._items = [MenuItem(*item) for item in items]
     Dialog.__init__(self, **kwds)
     h = self.font.get_linesize()
     self.height = h * len(self._items) + h
开发者ID:38115957,项目名称:mcedit,代码行数:7,代码来源:menu.py

示例2: __init__

 def __init__(self, title, responses, default=None, ok_action=None):
     self.response = responses[0]
     self.ok_action = ok_action
     title = Label(title)
     self.w_type = ChoiceButton(responses)
     col = Column([title, self.w_type, Row([Button("OK", action=ok_action or self.dismiss_ok), Button("Cancel", action=ok_action or self.dismiss)], margin=0)], margin=0, spacing=2)
     Dialog.__init__(self, client=col)
开发者ID:Nerocat,项目名称:MCEdit-Unified,代码行数:7,代码来源:tree.py

示例3: __edit_prefs

 def __edit_prefs(self, *args):
     kmap = {
         'hide-read':'bool',
         'update-interval':'int',
         'max-articles':'int',
         'use-notify':'bool',
         'on-the-fly':'bool',
         'enable-debug':'bool',
         'auto-update':'bool',
         'live-search':'bool',
         'auto-hide-search':'bool',
         'show-status':'bool',
         }
     hmap = {
         'hide-read':_('Hide Read Items'),
         'update-interval':_('Update interval (in minutes)'),
         'max-articles':_('Maximum number of articles to keep (excluding starred)'),
         'auto-update':_('Allow the engine to download new articles automatically.'),
         'on-the-fly':_('Start downloading articles for new feeds on-the-fly'),
         'use-notify':_('Show notification on updates'),
         'enable-debug':_('Enable detailed logs'),
         'live-search':_('Return search results as you type'),
         'auto-hide-search':_('Hide Search form on results'),
         'show-status':_('Show the bottom status bar'),
         }
     data = []
     for k,v in kmap.iteritems():
         data.append({
             'type':v,
             'name':k,
             'header':hmap.get(k),#FIXME: can this be gotten from gsettings?
             })
     d = Dialog(self, _('Edit preferences'), data, self.settings)
     r = d.run()
     d.destroy()
开发者ID:bidossessi,项目名称:brss,代码行数:35,代码来源:reader.py

示例4: __add_category

 def __add_category(self, *args):
     args = [
     {'type':'str','name':'name', 'header':_('Name') },
         ]
     d = Dialog(self, _('Add a category'), args)
     r = d.run()
     item = d.response
     item['type'] = 'category'
     d.destroy()
     if r == Gtk.ResponseType.OK:
         self.__create(item)
开发者ID:bidossessi,项目名称:brss,代码行数:11,代码来源:reader.py

示例5: __add_feed

 def __add_feed(self, *args):
     data = [
     {'type':'str','name':'url', 'header':_('Link') },
         ]
     d = Dialog(self, _('Add a feed'), data)
     r = d.run()
     item = d.response
     item['type'] = 'feed'
     d.destroy()
     if r == Gtk.ResponseType.OK:
         self.__create(item)
开发者ID:bidossessi,项目名称:brss,代码行数:11,代码来源:reader.py

示例6: __init__

    def __init__(self, title, items, scrolling=False, scroll_items=30,
                 scroll_page=5, handler=None, **kwds):
        self.handler = handler
        self.title = _(title, doNotTranslate=kwds.get('doNotTranslate', False))
        self.items = items
        self._items = [MenuItem(*item, doNotTranslate=kwds.get('doNotTranslate', False)) for item in items]
        self.scrolling = scrolling and len(self._items) > scroll_items
        self.scroll_items = scroll_items
        self.scroll_page = scroll_page
        Dialog.__init__(self, **kwds)

        self.root = self.get_root()
        self.calc_size()
开发者ID:BossosaurusRex,项目名称:MCEdit-Unified,代码行数:13,代码来源:menu.py

示例7: __init__

    def __init__(self, title, items, scrolling=False, scroll_items=30,
                 scroll_page=5, **kwds):
        self.title = _(title)
        self.items = items
        self._items = [MenuItem(*item) for item in items]
        self.scrolling = scrolling and len(self._items) > scroll_items
        self.scroll_items = scroll_items
        self.scroll_page = scroll_page
        Dialog.__init__(self, **kwds)

        h = self.font.get_linesize()
        if self.scrolling:
            self.height = h * self.scroll_items + h
        else:
            self.height = h * len(self._items) + h
开发者ID:TrazLander,项目名称:Traz-Fork-MCEdit-Unified,代码行数:15,代码来源:menu.py

示例8: mouse_down

    def mouse_down(self, event):
        if event.button == 1:
            if self.scrolling:
                p = event.local
                if self.scroll_up_rect().collidepoint(p):
                    self.scroll_up()
                    return
                elif self.scroll_down_rect().collidepoint(p):
                    self.scroll_down()
                    return
        if event.button == 4:
            self.scroll_up()
        if event.button == 5:
            self.scroll_down()

        Dialog.mouse_down(self, event)
开发者ID:BossosaurusRex,项目名称:MCEdit-Unified,代码行数:16,代码来源:menu.py

示例9: __edit_item

 def __edit_item(self, *args):
     item = self.tree.current_item #FIXME: not good!!
     print item
     if item['type'] == 'category':
         args = [{'type':'str','name':'name', 'header':_('Name'), 'value':item['name'] },]
         d = Dialog(self, _('Edit this category'), args)
     elif item['type'] == 'feed':
         args = [{'type':'str','name':'url', 'header':_('Link'), 'value':item['url'] },]
         d = Dialog(self, _('Edit this feed'), args)
     r = d.run()
     o = d.response
     for k,v in o.iteritems():
         item[k] = v
     d.destroy()
     if r == Gtk.ResponseType.OK:
         self.__edit(item)
开发者ID:bidossessi,项目名称:brss,代码行数:16,代码来源:reader.py

示例10: present

    def present(self, client, pos):
        client = client or self.root
        self.topleft = client.local_to_global(pos)
        focus = self.handler or get_focus()
        font = self.font
        h = font.get_linesize()
        items = self._items
        margin = self.margin
        if self.scrolling:
            height = h * self.scroll_items + h
        else:
            height = h * len(items) + h
        w1 = w2 = 0
        for item in items:
            item.enabled = self.command_is_enabled(item, focus)
            w1 = max(w1, font.size(item.text)[0])
            w2 = max(w2, font.size(item.keyname)[0])
        width = w1 + 2 * margin
        self._key_margin = width
        if w2 > 0:
            width += w2 + margin
        if self.scrolling:
            width += self.scroll_button_size
        self.size = (width, height)
        self._hilited = None

        self.rect.clamp_ip(self.root.rect)

        return Dialog.present(self, centered=False)
开发者ID:BossosaurusRex,项目名称:MCEdit-Unified,代码行数:29,代码来源:menu.py

示例11: body

 def body(self, master):
     if not self.Fieldvars:
         logger.debug("Creating username and password tk StringVars Fieldvars. Initial username is: %s", self.Initial_username)
         # Notice: you should specify the variables' master; otherwise, if you instantiate
         # multiple tk.Tk() instances during e.g. testing, these will
         # mess up the variable logic (apparently...)
         self.Fieldvars = OrderedDict(
             username = [tk.StringVar(self.parent, value=self.Initial_username), 'Username', dict()],
             password = [tk.StringVar(self.parent), 'Password', dict(show="*")]
             )
     # Call to super:
     Dialog.body(self, master)
     logger.debug("login prompt created, self.Fieldvars is: %s, with values: %s",
                  self.Fieldvars,
                  "; ".join(u"{}: {}".format(k, bool(v[0].get())) for k, v in self.Fieldvars.items()))
     logger.debug("self.EntryWidgets have values: %s",
                  "; ".join(u"{}: {}".format(k, bool(v.get())) for k, v in self.EntryWidgets.items()))
开发者ID:scholer,项目名称:labfluence,代码行数:17,代码来源:loginprompt.py

示例12: take_screenshot

 def take_screenshot(self):
     try:
         os.mkdir(os.path.join(directories.getCacheDir(), "screenshots"))
     except OSError:
         pass
     screenshot_name = os.path.join(directories.getCacheDir(), "screenshots", time.strftime("%Y-%m-%d (%I-%M-%S-%p)") + ".png")
     pygame.image.save(pygame.display.get_surface(), screenshot_name)
     self.diag = Dialog()
     lbl = Label(_("Screenshot taken and saved as '%s'") % screenshot_name, doNotTranslate=True)
     folderBtn = Button("Open Folder", action=self.open_screenshots_folder)
     btn = Button("Ok", action=self.screenshot_notify)
     buttonsRow = Row((btn, folderBtn))
     col = Column((lbl, buttonsRow))
     self.diag.add(col)
     self.diag.shrink_wrap()
     self.diag.present()
开发者ID:Khroki,项目名称:MCEdit-Unified,代码行数:16,代码来源:root.py

示例13: present

	def present(self, client, pos):
		client = client or get_root()
		self.topleft = client.local_to_global(pos)
		focus = get_focus()
		font = self.font
		h = font.get_linesize()
		items = self._items
		margin = self.margin
		height = h * len(items) + h
		w1 = w2 = 0
		for item in items:
			item.enabled = self.command_is_enabled(item, focus)
			w1 = max(w1, font.size(item.text)[0])
			w2 = max(w2, font.size(item.keyname)[0])
		width = w1 + 2 * margin
		self._key_margin = width
		if w2 > 0:
			width += w2 + margin
		self.size = (width, height)
		self._hilited = None
		return Dialog.present(self, centered = False)
开发者ID:AnnanFay,项目名称:pyge-solitaire,代码行数:21,代码来源:menu.py

示例14: cancel

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      items = [{"label": "Option {}".format(i), "value": "Value {}".format(i)} for i in xrange(1,35)]

      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 52, 8)
      dropdown = Dropdown(1, items, 12)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      dropdown.setPopupWidth(10)
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Select option and press 'Ok' button:", 38), 1, 2)
      dialog.addComponent(dropdown, 38, 2)
      dialog.addComponent(bOk, 31, 6)
      dialog.addComponent(bCancel, 39, 6)
      dialog.center()

      dialog.draw()
      dialog.focus()
开发者ID:statgen,项目名称:dialogs,代码行数:30,代码来源:example9.py

示例15: showAlert

def showAlert(button):
   alert = Dialog("Alert", 40, 6, dialogs.ALERT_DIALOG_DECO)
   bOk = Button(1, "Ok", dialogs.ALERT_BUTTON_DECO)
   alert.addComponent(Label("Press 'Ok' button to close alert dialog.", 38), 1, 2)
   alert.addComponent(bOk, 31, 4)
   alert.center()

   def ok(button):
      alert.destroy()
      dialog.focus()
  
   bOk.setCallback(ok)
   dialog.unfocus()
   alert.draw()
   alert.focus()
开发者ID:statgen,项目名称:dialogs,代码行数:15,代码来源:example3.py


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