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


Python views.BaseView类代码示例

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


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

示例1: __init__

    def __init__(
        self,
        model,
        proxy_widgets=None,
        gladefile=None,
        toplevel=None,
        widgets=(),
        toplevel_name=None,
        domain=None,
        delete_handler=None,
        keyactions=None,
    ):
        """Creates a new Delegate.
        :param model: instance to be attached
        :param proxy_widgets:
        The keyactions parameter is sent to :class:`kiwi.controllers.BaseController`,
        the rest are sent to :class:`kiwi.ui.views.BaseView`
        """

        BaseView.__init__(self, toplevel, widgets, gladefile, toplevel_name, domain, delete_handler)
        self.model = model
        self.proxy = self.add_proxy(model, proxy_widgets)
        self.proxy.proxy_updated = self.proxy_updated

        BaseController.__init__(self, view=self, keyactions=keyactions)
开发者ID:RENATOZANETTI9,项目名称:kiwi,代码行数:25,代码来源:delegates.py

示例2: __init__

 def __init__(self):
     win = gtk.Window()
     win.set_title("I'm coming to London")
     label = gtk.Label("Anything to declare?")
     win.add(label)
     win.set_default_size(200, 50)
     BaseView.__init__(self, toplevel=win,
                       delete_handler=self.quit_if_last)
开发者ID:RENATOZANETTI9,项目名称:kiwi,代码行数:8,代码来源:hey.py

示例3: __init__

 def __init__(self):
     self.win = gtk.Window()
     self.label = gtk.Label("foobar!")
     self.win.add(self.label)
     BaseView.__init__(self, toplevel=self.win)
     BaseController.__init__(self, view=self)
     set_foreground(self.label, "#CC99FF")
     set_background(self.win, "#001100")
开发者ID:RENATOZANETTI9,项目名称:kiwi,代码行数:8,代码来源:test_BaseView.py

示例4: __init__

    def __init__(self, model):

        self.__model = model
        #self.__model.set_view(self)

        BaseView.__init__(self,
                               gladefile="virtlab",
                               delete_handler=self.quit_if_last)

  #      self.__col_pixbuf = gtk.TreeViewColumn("Image")
  #      cellrenderer_pixbuf = gtk.CellRendererPixbuf()
  #      cellrenderer_pixbuf.set_properties("pixbuf", )
  #      self.__col_pixbuf.pack_start(cellrenderer_pixbuf, False)
  #      self.__col_pixbuf.add_attribute(cellrenderer_pixbuf, "pixbuf", 1)

        tableColumns = [
                    Column("image", title=" ", width=30, data_type=gtk.gdk.Pixbuf, sorted=False),
                    Column("name", title='VM Name', width=130, sorted=True),
                    Column("state", title='State', width=70),
                    Column("order", title='Order (Delay/min)', width=145),
                    Column("ordinal", visible=False),
                    Column("delay", visible=False),
                    Column("desc", title='Description', width=200)
                    ]


        self.vmlist_widget = ObjectList(tableColumns)
        self.vmlist_widget.set_size_request(300, 400)
        self.vmlist_widget.set_selection_mode(gtk.SELECTION_SINGLE)
        self.hbox4.pack_start(self.vmlist_widget)

        store = gtk.ListStore(gobject.TYPE_STRING)

        self.vmlist_widget.show()

        self.__dialog = None
        self.__status_text = gtk.TextBuffer()

        try:
            self.populate_vmlist()
            self.populate_order_dropdown(store, len(self.__model.get_vms()))
        except VMLabException as exception:
            if exception.vme_id is c.EXCEPTION_LIBVIRT_001:
                error("Initialization error",
                      "No connection to Libvirtd.\n Exiting.")
                exit(1)

        self.ordercombo.set_model(store)
        cell = gtk.CellRendererText()
        self.ordercombo.pack_start(cell, True)
        self.ordercombo.add_attribute(cell, 'text', 0)

        self.virtlab.set_size_request(800, 460)

        self.change_title("")
        self.__statusbar_ctx = self.statusbar.get_context_id("virtlab")
        self.virtlab.set_icon(gtk.gdk.pixbuf_new_from_file("pixmaps/about-logo.png"))
开发者ID:hsavolai,项目名称:vmlab,代码行数:57,代码来源:vmlab.py

示例5: __init__

 def __init__(self, toplevel=None, widgets=None, toplevel_name=None,
              delete_handler=None, keyactions=None):
     """Creates a new Delegate.
     The keyactions parameter is sent to :class:`kiwi.controllers.BaseController`,
     the rest are sent to :class:`kiwi.ui.views.BaseView`
     """
     BaseView.__init__(self,
                       toplevel=toplevel,
                       widgets=widgets or [],
                       toplevel_name=toplevel_name,
                       delete_handler=delete_handler)
     BaseController.__init__(self, view=self, keyactions=keyactions)
开发者ID:fuinha,项目名称:kiwi,代码行数:12,代码来源:delegates.py

示例6: __init__

 def __init__(self):
     win = gtk.Window()
     win.set_title("Silly question")
     win.set_border_width(12)
     label = gtk.Label("What is your favourite color?")
     box = gtk.VBox(spacing=6)
     box.pack_start(label, False)
     self.combo = ProxyComboEntry()
     self.combo.data_type = str
     self.combo.model_attribute = 'color'
     self.combo.prefill(load_colors(), sort=True)
     box.pack_start(self.combo, False)
     win.add(box)
     BaseView.__init__(self, toplevel=win,
                       delete_handler=self.quit_if_last)
开发者ID:RENATOZANETTI9,项目名称:kiwi,代码行数:15,代码来源:color2.py

示例7: BaseView

#!/usr/bin/env python
import gtk

from kiwi.ui.gadgets import quit_if_last
from kiwi.ui.views import BaseView

app = BaseView(gladefile="hey", delete_handler=quit_if_last)
app.show()
gtk.main()
开发者ID:RENATOZANETTI9,项目名称:kiwi,代码行数:9,代码来源:heyglade.py

示例8: __init__

 def __init__(self):
     BaseView.__init__(self, gladefile="faren.ui",
                       delete_handler=self.quit_if_last)
开发者ID:fuinha,项目名称:kiwi,代码行数:3,代码来源:faren2.py

示例9: clicked

	def clicked(self, widget, event):
		if package.to_install:
			if root:
				pacman = "pacman -S %s && read" % package.to_install
				command = [TERMINAL, "-e", pacman]
			else:
				pacman = "su --command='pacman -S %s && read'" % package.to_install
				command = [TERMINAL, "-e", pacman]
			out, errors = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
			if errors:
				raise errors
		else:
			print("No package to install")
		

shell = BaseView(gladefile="gpacnet", delete_handler=quit_if_last)

local = Local()
category = Category()
package = Package()
install = Install()


shell.attach_slave("category", category)
shell.attach_slave("package", package)



category.show_all()
category.focus_topmost()
package.show_all()
开发者ID:trojkat,项目名称:gpacnet,代码行数:31,代码来源:gpacnet.py

示例10: News

        "Reverend CyberSatan",
        "http://www.pigdog.org/auto/TheCorporateFuck/link/2683.html"),
    ("Those Crazy Dutch Have Resurrected Elvis",
        "Miss Conduct",
        "http://www.pigdog.org/auto/viva_la_musica/link/2678.html")
]

class News(SlaveView):
    def __init__(self):
        model = gtk.ListStore(str, str)
        treeview = gtk.TreeView(model)
        renderer = gtk.CellRendererText()
        col1 = gtk.TreeViewColumn('News', renderer, text=0)
        col2 = gtk.TreeViewColumn('Author', renderer, text=1)
        treeview.append_column(col1)
        treeview.append_column(col2)
        treeview.get_selection().set_mode(gtk.SELECTION_BROWSE)
        for item in news:
            model.append(item[:-1])
        SlaveView.__init__(self, treeview)

news = News()

shell = BaseView(gladefile="news_shell", delete_handler=quit_if_last)
shell.attach_slave("placeholder", news)

news.show_all()
news.focus_toplevel() # explained next section, don't worry
shell.show()
gtk.main()
开发者ID:Schevo,项目名称:kiwi,代码行数:30,代码来源:news.py

示例11: BaseView

#!/usr/bin/env python

import gtk

from kiwi.ui.views import BaseView, SlaveView
from kiwi.ui.objectlist import Column
from kiwi.ui.gadgets import quit_if_last

# Main window
addressbook = BaseView(gladefile="addressbook",
                       widgets=("add", "del"),
                       delete_handler=quit_if_last)

## Slave Components:
# Entry editor GUI component
entry_editor = SlaveView(toplevel=addressbook,
                         widgets=("name", "address", "phone"),
                         gladefile="entry_editor")
# Entries list GUI component
list_entries = SlaveView(toplevel=addressbook,
                         widgets=("table",),
                         gladefile="list_entries")

list_entries.table.set_columns([Column("name", title="Name"),
                                Column("address", title="Address"),
                                Column("phone", title="Phone")])

## Attach slaves to main window
addressbook.attach_slave("entry_editor", entry_editor)
addressbook.attach_slave("list", list_entries)
开发者ID:barbieri,项目名称:barbieri-playground,代码行数:30,代码来源:addressbook.py

示例12: __init__

 def __init__(self, toplevel=None, *args, **kw):
     PythonViewMixin.__init__(self)
     if toplevel is None:
         toplevel = self.create_toplevel_widget()
     BaseView.__init__(self, toplevel=toplevel, *args, **kw)
开发者ID:BackupTheBerlios,项目名称:pida-svn,代码行数:5,代码来源:kiwiviews.py

示例13: __init__

 def __init__(self):
     BaseView.__init__(self, delete_handler=quit_if_last)
     text = self.the_label.get_text() # attached by constructor
     self.the_label.set_markup('<b>%s</b>' % text)
     self.the_label.set_use_markup(True)
     self.set_title("Avi's declaration") # change window title
开发者ID:Schevo,项目名称:kiwi,代码行数:6,代码来源:heyglade3.py

示例14: Person

#!/usr/bin/env python
import gtk

from kiwi.model import PickledModel
from kiwi.ui.views import BaseView
from kiwi.ui.gadgets import quit_if_last

# define the class that holds our application data
class Person(PickledModel):
    name = ""
    address = ""
    phone = ""


person = Person.unpickle()  # load person instance

view = BaseView(delete_handler=quit_if_last, widgets=("name", "address", "phone"), gladefile="person")

# create and run a proxy interface attached to person
view.add_proxy(person, ("name", "address", "phone"))
view.focus_topmost()
view.show_all()

# Enter main lopp, where GTK will handle events
gtk.main()

# save changes done to theinstance
person.save()
开发者ID:nabster11,项目名称:barbieri-playground,代码行数:28,代码来源:person.py

示例15: FarenControl

#!/usr/bin/env python
import gtk

from kiwi.controllers import BaseController
from kiwi.ui.views import BaseView
from kiwi.ui.gadgets import quit_if_last


class FarenControl(BaseController):

    def on_quitbutton__clicked(self, *args):
        self.view.hide_and_quit()

    def after_temperature__insert_text(self, entry, *args):
        try:
            temp = float(entry.get_text())
        except ValueError:
            temp = 0
        celsius = (temp - 32) * 5 / 9.0
        farenheit = (temp * 9 / 5.0) + 32
        self.view.celsius.set_text("%.2f" % celsius)
        self.view.farenheit.set_text("%.2f" % farenheit)

widgets = ["quitbutton", "temperature", "celsius", "farenheit"]
view = BaseView(gladefile="faren.ui",
                delete_handler=quit_if_last, widgets=widgets)
ctl = FarenControl(view)
view.show()
gtk.main()
开发者ID:fuinha,项目名称:kiwi,代码行数:29,代码来源:faren.py


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