本文整理汇总了Python中Controller.Controller.clear_project方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.clear_project方法的具体用法?Python Controller.clear_project怎么用?Python Controller.clear_project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller.Controller
的用法示例。
在下文中一共展示了Controller.clear_project方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GTGui
# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import clear_project [as 别名]
class GTGui(Gtk.Window):
instance = None
def __init__(self):
Gtk.Window.__init__(self, title = 'Subte GTFS Builder', type = Gtk.WindowType.TOPLEVEL)
self.set_icon_name('subte')
GTGui.instance = weakref.ref(self)
self.connect('delete-event', self.on_quit)
# load up our database
self.db = libsubte.Database()
# setup a controller
self.controller = Controller(self)
vbox = Gtk.VBox(False)
# a tool bar
toolbar = self._build_tool_bar()
vbox.pack_start(toolbar, False, True, 0)
# a horizontal pane
self.main_pane = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
self.info_frame = Gtk.Frame()
self.map_frame = Gtk.Frame()
self.main_pane.pack1(self.info_frame)
self.main_pane.pack2(self.map_frame)
# info frame
box = Gtk.VBox(False)
notebook = Gtk.Notebook()
box.pack_start(notebook, True, True, 5)
self.stop_list_widget = StopListGui()
notebook.append_page(self.stop_list_widget.get_widget(), Gtk.Label(_('Stops')))
self.trip_list_widget = TripRouteListGui()
notebook.append_page(self.trip_list_widget.get_widget(), Gtk.Label(_('Trips')))
self.path_list_widget = PathListGui()
notebook.append_page(self.path_list_widget.get_widget(), Gtk.Label(_('Paths')))
self.info_frame.add(box)
# map frame
box = Gtk.VBox(False)
self.map_widget = GTMap()
box.pack_start(self.map_widget, True, True, 5)
self.map_frame.add(box)
vbox.pack_start(self.main_pane, True, True, 15)
self.add(vbox)
# initialize the controller
self.controller.initialize()
# some signals
#!lukstafi -- changed button-release to button-press
self.map_widget.view.connect('button-press-event', self.controller.on_map_click, self.map_widget)
#!lukstafi -- for some reason AddTripRoute dialogs behave as modal
# although they should be modeless, and these or similar signals
# are not sent when AddTripRoute dialogs are open
self.stop_list_widget.treeview.connect('cursor-changed', self.controller.on_stop_list_selected)
self.trip_list_widget.treeview.connect('cursor-changed', self.controller.on_route_trip_list_selected)
def on_quit(self, widget, evt, data = None):
# try to save
if self.controller.clear_project(True) == False: # they cancelled, stay in
return True
GTGui.instance = None
Gtk.main_quit()
return True
def _build_tool_bar(self):
toolbar = Gtk.Toolbar()
toolbar.set_icon_size(Gtk.IconSize.LARGE_TOOLBAR)
#toolbar.set_style(Gtk.ToolbarStyle.BOTH_HORIZ)
## LOAD/SAVE/CLOSE DB
load_db = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN)
load_db.set_tooltip_text(_('Load a project'))
load_db.connect('clicked', self.controller.on_load_project_clicked)
toolbar.add(load_db)
save_db = Gtk.ToolButton.new_from_stock(Gtk.STOCK_SAVE)
save_db.set_tooltip_text(_('Save a project'))
save_db.connect('clicked', self.controller.on_save_project_clicked)
toolbar.add(save_db)
close_db = Gtk.ToolButton.new_from_stock(Gtk.STOCK_CLOSE)
close_db.set_tooltip_text(_('Close a project'))
close_db.connect('clicked', self.controller.on_close_project_clicked)
toolbar.add(close_db)
toolbar.add(Gtk.SeparatorToolItem())
#.........这里部分代码省略.........