def __init__(self, parent): super(Control, self).__init__(parent, -1, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_NO_LINES|wx.BORDER_STATIC) self.control = None self.cache = None font = self.GetFont() font.SetPointSize(10) self.SetFont(font) images = wx.ImageList(16, 16) images.Add(util.get_icon('bullet_go.png')) images.Add(util.get_icon('bullet_orange.png')) self.SetImageList(images) self.images = images self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_sel_changed)
def __init__(self, title, height=400): self.window = gtk.Window() self.window.set_title(title) self.window.set_size_request(600, int(height)) self.window.set_icon(get_icon()) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) vbox = gtk.VBox() quit_button = gtk.Button("_Close") quit_button.connect("clicked", lambda x: self.window.destroy()) vbox.pack_start(sw) vbox.pack_start(quit_button, False) textview = gtk.TextView() textview.set_border_width(5) textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#def")) textview.set_editable(False) textview.set_wrap_mode(gtk.WRAP_WORD) sw.add(textview) self.window.add(vbox) self.tb = textview.get_buffer() self.tag_text = self.tb.create_tag(None, foreground="#222") self.tag_title = self.tb.create_tag(None, foreground="#003") self.tag_heading = self.tb.create_tag(None, foreground="#008") self.tag_subheading = self.tb.create_tag(None, foreground="#00f") self.tag_bold = self.tb.create_tag(None, weight=pango.WEIGHT_BOLD) self.add_main_heading(title) quit_button.grab_focus()
def __init__(self, main, window_type=Const.WDW_SPLASH): self.img_list = [] self.img_button = [] if window_type == Const.WDW_WELCOME: self._mgmt_welcome() tk.Toplevel.__init__(self, main) self.iconbitmap(util.get_icon(r.ICO_HELP)) self.wm_protocol("WM_DELETE_WINDOW", lambda: self._quit(main)) self.minsize(300, 300) self.title(self._get_title(window_type)) self.img_index = 0 self.see_it_again = tk.StringVar() self.see_it_again.set(main.init_config.get('see_welcome')) self.fig = '' self.text = '' self.tutorial = '' if window_type == Const.WDW_WELCOME: self._frame_welcome() elif window_type == Const.WDW_ABOUT: self._mgmt_about() elif window_type == Const.WDW_TUTORIAL: self._mgmt_tutorial()
def __init__(self, parent = None): super(LoginDialog, self).__init__(parent) self.ui = Ui_LoginDialog() self.ui.setupUi(self) self.setWindowIcon(get_icon("appicon")) self.ui.buttonBox.accepted.connect(self.accepted) self.loadText()
def __init__(self): # CREATE MAIN WINDOW tk.Tk.__init__(self) self.title("Busload Calc " + Const.__version__) self.option_add('*tearOff', False) self.geometry('900x600') self.minsize(480, 600) self.iconbitmap(util.get_icon(r.ICO_MAIN)) self.wm_protocol("WM_DELETE_WINDOW", lambda: self.quit()) # CREATE MAIN MENU OBJECT self.menu = CreateMenu(self) # CREATE STATUS BAR self.status_bar = StatusBar(self) # SET GLOBAL PARAMETERS self.pos = [] # main window position self.init_position = 0 # initial position for new child window self.child_windows = [] # list of child windows self.configs = [] # list of configurations self.init_config = [] self.side_is_open = False self.default_status_bar_message() self._apply_file_init() self.status_bar.responsible.set(self.init_config.get('responsible')) if self.init_config.get('see_welcome') == '0': self.open_welcome_window()
def create_tab(self, path=None): if path: path = os.path.abspath(path) for window in self.get_windows(): if not window.file_path: continue p1 = os.path.normcase(path) p2 = os.path.normcase(window.file_path) if p1 == p2: window.SetFocus() return if not os.path.exists(path): return self.Freeze() if path: self.close_untitled_tab() widget = control.EditorControl(self, -1, style=wx.BORDER_NONE) widget.SetDropTarget(DropTarget(self)) if path: widget.open_file(path) widget.Bind(control.EVT_EDITOR_STATUS_CHANGED, self.on_status_changed) self.AddPage(widget, widget.get_name(), True, util.get_icon('page.png')) widget.SetFocus() self.bind_tab_control() self.recent_path(path) self.check_tabs() self.Thaw()
def on_status_changed(self, event): tab = event.GetEventObject() if tab.edited: icon = 'page_red.png' else: icon = 'page.png' index = self.GetPageIndex(tab) if index >= 0: self.SetPageBitmap(index, util.get_icon(icon))
def __init__(self, parent, replace=False): super(Find, self).__init__(parent, -1, 'Replace' if replace else 'Find') self.replace = replace sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.create_controls(), 1, wx.EXPAND|wx.ALL, 10) sizer.Add(self.create_buttons(), 0, wx.EXPAND|wx.ALL&~wx.LEFT, 10) self.SetSizerAndFit(sizer) self.Bind(wx.EVT_ACTIVATE, self.on_activate) self.SetIcon(wx.IconFromBitmap(util.get_icon('text_replace.png' if replace else 'find.png'))) self.load_state()
def create_gui_panel( self ): logviewer.create_gui_panel( self ) self.window = gtk.Window() #self.window.set_border_width(5) self.window.set_title( "log viewer" ) self.window.set_size_request(600, 400) self.window.set_icon( get_icon() ) combobox = gtk.combo_box_new_text() combobox.append_text( 'Task' ) combobox.append_text( 'all' ) for task in self.task_list: combobox.append_text( task ) combobox.connect("changed", self.filter_log ) combobox.set_active(0) newer = gtk.Button( "_newer" ) newer.connect("clicked", self.rotate_log, False ) self.hbox.pack_end( newer, False ) older = gtk.Button( "_older" ) older.connect("clicked", self.rotate_log, True ) self.hbox.pack_end( older, False ) self.hbox.pack_end( combobox, False ) filterbox = gtk.HBox() entry = gtk.Entry() entry.connect( "activate", self.custom_filter_log ) label = gtk.Label('Filter') filterbox.pack_start(label, True) filterbox.pack_start(entry, True) self.hbox.pack_end( filterbox, False ) close = gtk.Button( "_Close" ) close.connect("clicked", self.shutdown, None, self.window ) self.hbox.pack_start( close, False ) self.window.add( self.vbox ) self.window.connect("delete_event", self.shutdown, self.window ) self.window.show_all()
def create_gui_panel(self): logviewer.create_gui_panel(self) self.window = gtk.Window() #self.window.set_border_width(5) self.window.set_title("log viewer") self.window.set_size_request(800, 400) self.window.set_icon(get_icon()) combobox = gtk.combo_box_new_text() combobox.append_text('Task') combobox.append_text('all') for task in self.task_list: combobox.append_text(task) combobox.connect("changed", self.filter_log) combobox.set_active(0) newer = gtk.Button("_newer") newer.connect("clicked", self.rotate_log, False) self.hbox.pack_end(newer, False) older = gtk.Button("_older") older.connect("clicked", self.rotate_log, True) self.hbox.pack_end(older, False) self.hbox.pack_end(combobox, False) filterbox = gtk.HBox() entry = gtk.Entry() entry.connect("activate", self.custom_filter_log) label = gtk.Label('Filter') filterbox.pack_start(label, True) filterbox.pack_start(entry, True) self.hbox.pack_end(filterbox, False) close = gtk.Button("_Close") close.connect("clicked", self.shutdown, None, self.window) self.hbox.pack_start(close, False) self.window.add(self.vbox) self.window.connect("delete_event", self.shutdown, self.window) self.window.show_all()
def __init__(self, msg, parent=None): self.dialog = gtk.MessageDialog( parent, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, msg) self.dialog.set_icon(get_icon())
def __init__(self, msg, parent=None): self.dialog = gtk.MessageDialog( parent, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, msg) self.dialog.set_icon(get_icon())
def configUI(self): # Устанавливаем иконки к действиям: self.setWindowIcon(get_icon("appicon")) self.ui.view_clients.setIcon(get_icon("customer")) self.ui.view_employees.setIcon(get_icon("employee")) self.ui.view_shops.setIcon(get_icon("shop")) self.ui.view_details.setIcon(get_icon("detail")) self.ui.view_cars.setIcon(get_icon("car")) self.ui.view_warehouse.setIcon(get_icon("warehouse")) self.ui.view_cardetails.setIcon(get_icon("cardetails")) self.ui.view_orders.setIcon(get_icon("order")) self.ui.report_day.triggered.connect(self.reportDay) self.ui.report_month.triggered.connect(self.reportMonth) # Настраиваем переключение форм: actions = [self.ui.view_clients, self.ui.view_orders, self.ui.view_employees, self.ui.view_shops, self.ui.view_warehouse, self.ui.view_details, self.ui.view_cars, self.ui.view_cardetails] for act in actions: act.triggered.connect((lambda a: lambda: self.actionTriggered(a))(act)) # Форма "Клиенты": self._clientForm = GenericFormController("customer", self.dbase, {"widget": self.ui.clientListView, "role": "view", "format": "{lastname} {firstname:.1}. {middlename:.1}."}, {"widget": self.ui.clientAddButton, "role": "insert"}, {"widget": self.ui.clientDeleteButton, "role": "delete"}, {"widget": self.ui.clientSaveButton, "role": "commit"}, {"widget": self.ui.clientCancelButton, "role": "rollback"}, {"widget": self.ui.clientFirstnameLabel, "role": "display", "column": "firstname"}, {"widget": self.ui.clientLastnameLabel, "role": "display", "column": "lastname"}, {"widget": self.ui.clientMiddlenameLabel, "role": "display", "column": "middlename"}, {"widget": self.ui.clientBirthdateLabel, "role": "display", "column": "birthdate"}, {"widget": self.ui.clientRegdateLabel, "role": "display", "column": "regdate"}, {"widget": self.ui.clientEmailLabel, "role": "display", "column": "email"}, {"widget": self.ui.clientPhoneLabel, "role": "display", "column": "phone"}, {"widget": self.ui.clientPassportLabel, "role": "display", "column": "passport"}, {"widget": self.ui.clientFirstnameEdit, "role": "edit", "column": "firstname"}, {"widget": self.ui.clientLastnameEdit, "role": "edit", "column": "lastname"}, {"widget": self.ui.clientMiddlenameEdit, "role": "edit", "column": "middlename"}, {"widget": self.ui.clientBirthdateEdit, "role": "edit", "column": "birthdate"}, {"widget": self.ui.clientRegdateEdit, "role": "edit", "column": "regdate"}, {"widget": self.ui.clientEmailEdit, "role": "edit", "column": "email"}, {"widget": self.ui.clientPhoneEdit, "role": "edit", "column": "phone"}, {"widget": self.ui.clientPassportEdit, "role": "edit", "column": "passport"} ) self.setupForm(self._clientForm, self.ui.clientEditButton, self.ui.clientStack, self.ui.clientReadPage, self.ui.clientWritePage) # Форма "Магазины": self._shopForm = GenericFormController("shop", self.dbase, {"widget": self.ui.shopListView, "role": "view", "format": "{name}"}, {"widget": self.ui.shopAddButton, "role": "insert"}, {"widget": self.ui.shopDeleteButton, "role": "delete"}, {"widget": self.ui.shopSaveButton, "role": "commit"}, {"widget": self.ui.shopCancelButton, "role": "rollback"}, {"widget": self.ui.shopAddressLabel, "role": "display", "column": "address"}, {"widget": self.ui.shopDescriptionLabel, "role": "display", "column": "description"}, {"widget": self.ui.shopNameLabel, "role": "display", "column": "name"}, {"widget": self.ui.shopPhoneLabel, "role": "display", "column": "phone"}, {"widget": self.ui.shopDescriptionEdit, "role": "edit", "column": "description"}, {"widget": self.ui.shopNameEdit, "role": "edit", "column": "name"}, {"widget": self.ui.shopPhoneEdit, "role": "edit", "column": "phone"}, {"widget": self.ui.shopAddressEdit, "role": "edit", "column": "address"}, ) self.setupForm(self._shopForm, self.ui.shopEditButton, self.ui.shopStack, self.ui.shopReadPage, self.ui.shopWritePage) # Форма "Машины": self._carForm = PhotoFormController("car", self.dbase, {"widget": self.ui.carListView, "role": "view", "format": "{name}"}, {"widget": self.ui.carAddButton, "role": "insert"}, {"widget": self.ui.carDeleteButton, "role": "delete"}, {"widget": self.ui.carSaveButton, "role": "commit"}, {"widget": self.ui.carCancelButton, "role": "rollback"}, {"widget": self.ui.carDescriptionLabel, "role": "display", "column": "description"}, {"widget": self.ui.carNameLabel, "role": "display", "column": "name"}, {"widget": self.ui.carProddateLabel, "role": "display", "column": "proddate"}, {"widget": self.ui.carDescriptionEdit, "role": "edit", "column": "description"}, {"widget": self.ui.carNameEdit, "role": "edit", "column": "name"}, {"widget": self.ui.carProddateEdit, "role": "edit", "column": "proddate"}, {"widget": self.ui.carPhotoLabel, "role": "photo", "column": "photo"}, {"widget": self.ui.carPhotoLabel_2, "role": "photo", "column": "photo"}, {"widget": self.ui.carBrowsePhotoButton, "role": "browse_photo", "column": "photo"}, {"widget": self.ui.carDeletePhotoButton, "role": "delete_photo", "column": "photo"} ) self.setupForm(self._carForm, self.ui.carEditButton, self.ui.carStack, self.ui.carReadPage, self.ui.carWritePage) # Форма "Детали": self._detailForm = PhotoFormController("detail", self.dbase, {"widget": self.ui.detailListView, "role": "view", "format": "{article}: {name}"}, {"widget": self.ui.detailAddButton, "role": "insert"}, {"widget": self.ui.detailDeleteButton, "role": "delete"}, {"widget": self.ui.detailSaveButton, "role": "commit"}, {"widget": self.ui.detailCancelButton, "role": "rollback"}, {"widget": self.ui.detailDescriptionLabel, "role": "display", "column": "description"}, {"widget": self.ui.detailNameLabel, "role": "display", "column": "name"}, {"widget": self.ui.detailArticleLabel, "role": "display", "column": "article"}, {"widget": self.ui.detailCategoryLabel, "role": "display", "column": "category"}, {"widget": self.ui.detailPriceLabel, "role": "display", "column": "price"}, {"widget": self.ui.detailWarrantyLabel, "role": "display", "column": "warranty"}, {"widget": self.ui.detailDescriptionEdit, "role": "edit", "column": "description"}, {"widget": self.ui.detailNameEdit, "role": "edit", "column": "name"}, {"widget": self.ui.detailArticleEdit, "role": "edit", "column": "article"}, {"widget": self.ui.detailCategoryEdit, "role": "edit", "column": "category"}, {"widget": self.ui.detailPriceEdit, "role": "edit", "column": "price"}, {"widget": self.ui.detailWarrantyEdit, "role": "edit", "column": "warranty"}, {"widget": self.ui.detailPhotoLabel, "role": "photo", "column": "photo"}, {"widget": self.ui.detailPhotoLabel_2, "role": "photo", "column": "photo"}, {"widget": self.ui.detailBrowsePhotoButton, "role": "browse_photo", "column": "photo"}, {"widget": self.ui.detailDeletePhotoButton, "role": "delete_photo", "column": "photo"} ) self.setupForm(self._detailForm, self.ui.detailEditButton, self.ui.detailStack, self.ui.detailReadPage, self.ui.detailWritePage) # Форма "Работники": self._empForm = ForeignFormController("employee", self.dbase, {"widget": self.ui.empListView, "role": "view", "format": "{lastname} {firstname:.1}. {middlename:.1}."}, {"widget": self.ui.empAddButton, "role": "insert"}, {"widget": self.ui.empDeleteButton, "role": "delete"}, {"widget": self.ui.empSaveButton, "role": "commit"}, {"widget": self.ui.empCancelButton, "role": "rollback"}, {"widget": self.ui.empLastnameLabel, "role": "display", "column": "lastname"}, {"widget": self.ui.empFirstnameLabel, "role": "display", "column": "firstname"}, {"widget": self.ui.empMiddlenameLabel, "role": "display", "column": "middlename"}, {"widget": self.ui.empBirthdateLabel, "role": "display", "column": "birthdate"}, {"widget": self.ui.empDepartmentLabel, "role": "display", "column": "department"}, {"widget": self.ui.empEmpdateLabel, "role": "display", "column": "empdate"}, {"widget": self.ui.empPassportLabel, "role": "display", "column": "passport"}, {"widget": self.ui.empPositionLabel, "role": "display", "column": "position"}, {"widget": self.ui.empSalaryLabel, "role": "display", "column": "salary"}, {"widget": self.ui.empLastnameEdit, "role": "edit", "column": "lastname"}, {"widget": self.ui.empFirstnameEdit, "role": "edit", "column": "firstname"}, {"widget": self.ui.empMiddlenameEdit, "role": "edit", "column": "middlename"}, {"widget": self.ui.empBirthdateEdit, "role": "edit", "column": "birthdate"}, {"widget": self.ui.empDepartmentEdit, "role": "edit", "column": "department"}, {"widget": self.ui.empEmpdateEdit, "role": "edit", "column": "empdate"}, {"widget": self.ui.empPassportEdit, "role": "edit", "column": "passport"}, {"widget": self.ui.empPositionEdit, "role": "edit", "column": "position"}, {"widget": self.ui.empSalaryEdit, "role": "edit", "column": "salary"}, {"widget": self.ui.empShopEdit, "role": "edit", "column": "shop_id"}, {"widget": self.ui.empShopProxyLabel, "role": "proxy_display", "source": self.ui.empShopEdit, "table": "shop", "column": "id", "format": "{name}"}, {"widget": self.ui.empShopProxyCombo, "role": "proxy_edit", "source": self.ui.empShopEdit, "table": "shop", "column": "id", "format": "{name}"}, ) self.setupForm(self._empForm, self.ui.empEditButton, self.ui.empStack, self.ui.empReadPage, self.ui.empWritePage) # Форма "Склад": self._warehouseForm = WarehouseController(self.ui.warehouseShopView, self.ui.warehouseDetailView, self.ui.warehouseAddButton, self.ui.warehouseEditButton, self.ui.warehouseDeleteButton, self.dbase) # Форма "Запчасти машин": self._carDetailForm = CarDetailController(self.ui.carListView_2, self.ui.carDetailListView, self.ui.carDetailAddButton, self.ui.carDetailDeleteButton, self.dbase) # Форма "Заказы": orderForm = ForeignFormController("orders", self.dbase, {"widget": self.ui.orderListView, "role": "view", "format": "#{id}"}, {"widget": self.ui.orderAddButton, "role": "insert"}, {"widget": self.ui.orderDeleteButton, "role": "delete"}, {"widget": self.ui.orderSaveButton, "role": "commit"}, {"widget": self.ui.orderCancelButton, "role": "rollback"}, {"widget": self.ui.orderDateLabel, "role": "display", "column": "regdate"}, {"widget": self.ui.orderPriceLabel, "role": "display", "column": "price"}, {"widget": self.ui.orderPriceLabel_2, "role": "display", "column": "price"}, {"widget": self.ui.orderPriceSpin, "role": "edit", "column": "price"}, {"widget": self.ui.orderClientSpin, "role": "edit", "column": "customer_id"}, {"widget": self.ui.orderShopSpin, "role": "edit", "column": "shop_id"}, {"widget": self.ui.orderEmpSpin, "role": "edit", "column": "employee_id"}, {"widget": self.ui.orderDateEdit, "role": "edit", "column": "regdate"}, {"widget": self.ui.orderClientLabel, "role": "proxy_display", "source": self.ui.orderClientSpin, "table": "customer", "column": "id", "format": "{lastname} {firstname:.1}. {middlename:.1}."}, {"widget": self.ui.orderEmpLabel, "role": "proxy_display", "source": self.ui.orderEmpSpin, "table": "employee", "column": "id", "format": "{lastname} {firstname:.1}. {middlename:.1}."}, {"widget": self.ui.orderShopLabel, "role": "proxy_display", "source": self.ui.orderShopSpin, "table": "shop", "column": "id", "format": "{name}"}, {"widget": self.ui.orderClientCombo, "role": "proxy_edit", "source": self.ui.orderClientSpin, "table": "customer", "column": "id", "format": "{lastname} {firstname:.1}. {middlename:.1}."}, {"widget": self.ui.orderEmpCombo, "role": "proxy_edit", "source": self.ui.orderEmpSpin, "table": "employee", "column": "id", "format": "{lastname} {firstname:.1}. {middlename:.1}."}, {"widget": self.ui.orderShopCombo, "role": "proxy_edit", "source": self.ui.orderShopSpin, "table": "shop", "column": "id", "format": "{name}"}, ) self.setupForm(orderForm, self.ui.orderEditButton, self.ui.orderStack, self.ui.orderReadPage, self.ui.orderWritePage) self._orderForm = OrderController(orderForm, self.ui.orderDetailView, self.ui.orderDetailAddButton, self.ui.orderDetailEditButton, self.ui.orderDetailDeleteButton, self.dbase, self)
def __init__(self, parent, db, db_owner, tmpdir, pyro_timeout ): self.db = db self.db_owner = db_owner if pyro_timeout: self.pyro_timeout = float(pyro_timeout) else: self.pyro_timeout = None self.regname = None self.updater = None self.tmpdir = tmpdir self.gcapture_windows = [] gobject.threads_init() #self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Dialog( "Choose a suite", parent, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) #self.window.set_modal(True) self.window.set_title("Suite Chooser" ) self.window.set_size_request(750, 400) self.window.set_icon(get_icon()) # TODO: not needed for a dialog window? #self.window.set_border_width( 5 ) self.window.connect("delete_event", self.delete_all_event) sw = gtk.ScrolledWindow() sw.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC ) self.regd_treeview = gtk.TreeView() self.regd_treestore = gtk.TreeStore( str, str, str, str, str, str, str ) self.regd_treeview.set_model(self.regd_treestore) self.regd_treeview.set_rules_hint(True) # search column zero (Ctrl-F) self.regd_treeview.connect( 'key_press_event', self.on_suite_select ) self.regd_treeview.connect( 'button_press_event', self.on_suite_select ) self.regd_treeview.set_search_column(0) # Start updating the liststore now, as we need values in it # immediately below (it may be possible to delay this till the # end of __init___() but it doesn't really matter. if self.db: self.dbopt = '--db='+self.db else: self.dbopt = '' regd_ts = self.regd_treeview.get_selection() regd_ts.set_mode( gtk.SELECTION_SINGLE ) cr = gtk.CellRendererText() #cr.set_property( 'cell-background', '#def' ) tvc = gtk.TreeViewColumn( 'Suite', cr, text=0, foreground=4, background=5 ) tvc.set_resizable(True) tvc.set_sort_column_id(0) self.regd_treeview.append_column( tvc ) cr = gtk.CellRendererText() tvc = gtk.TreeViewColumn( 'Port', cr, text=1, foreground=4, background=5 ) tvc.set_resizable(True) # not sure how this sorting works #tvc.set_sort_column_id(1) self.regd_treeview.append_column( tvc ) cr = gtk.CellRendererText() #cr.set_property( 'cell-background', '#def' ) tvc = gtk.TreeViewColumn( 'Title', cr, markup=2, foreground=4, background=6 ) tvc.set_resizable(True) #vc.set_sort_column_id(2) self.regd_treeview.append_column( tvc ) cr = gtk.CellRendererText() tvc = gtk.TreeViewColumn( 'Location', cr, text=3, foreground=4, background=5 ) tvc.set_resizable(True) #vc.set_sort_column_id(3) self.regd_treeview.append_column( tvc ) vbox = self.window.vbox sw.add( self.regd_treeview ) vbox.pack_start( sw, True ) self.selected_label_text = '(double-click or OK to select; right-click for db options)' self.selected_label = gtk.Label( self.selected_label_text ) filter_entry = EntryTempText() filter_entry.set_width_chars( 7 ) # Reduce width in toolbar filter_entry.connect( "activate", self.filter ) filter_entry.set_temp_text( "filter" ) filter_toolitem = gtk.ToolItem() filter_toolitem.add(filter_entry) tooltip = gtk.Tooltips() tooltip.enable() tooltip.set_tip(filter_toolitem, "Filter suites \n(enter a sub-string or regex)") expand_button = gtk.ToolButton() image = gtk.image_new_from_stock( gtk.STOCK_ADD, gtk.ICON_SIZE_SMALL_TOOLBAR ) expand_button.set_icon_widget( image ) expand_button.connect( 'clicked', lambda x: self.regd_treeview.expand_all() ) collapse_button = gtk.ToolButton() image = gtk.image_new_from_stock( gtk.STOCK_REMOVE, gtk.ICON_SIZE_SMALL_TOOLBAR ) collapse_button.set_icon_widget( image ) collapse_button.connect( 'clicked', lambda x: self.regd_treeview.collapse_all() ) hbox = gtk.HBox() eb = gtk.EventBox() eb.add( self.selected_label ) eb.modify_bg( gtk.STATE_NORMAL, gtk.gdk.color_parse( '#bbc' ) ) hbox.pack_start( eb, True ) hbox.pack_start( expand_button, False ) hbox.pack_start( collapse_button, False ) hbox.pack_start (filter_toolitem, False) vbox.pack_start( hbox, False ) self.window.show_all() self.start_updater()
def __init__(self, command, stdoutfile, width=400, height=400, standalone=False, ignore_command=False): self.standalone = standalone self.command = command self.ignore_command = ignore_command self.stdout = stdoutfile self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(5) self.window.set_title("subprocess output capture") self.window.connect("delete_event", self.quit) self.window.set_size_request(width, height) self.window.set_icon(get_icon()) self.quit_already = False self.find_current = None self.find_current_iter = None self.search_warning_done = False sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView() self.textview.set_editable(False) self.textview.set_wrap_mode(gtk.WRAP_WORD) # Use a monospace font. This is safe - by testing - setting an # illegal font description has no effect. self.textview.modify_font(pango.FontDescription("monospace")) tb = self.textview.get_buffer() self.blue = tb.create_tag(None, foreground="darkblue") self.ftag = tb.create_tag(None, background="#70FFA9") self.warning_re = "WARNING" self.critical_re = "CRITICAL|ERROR" if not self.ignore_command: tb.insert_with_tags(tb.get_end_iter(), "command: " + command + "\n", self.blue) tb.insert_with_tags(tb.get_end_iter(), "output : " + stdoutfile.name + "\n\n", self.blue) vbox = gtk.VBox() sw.add(self.textview) frame = gtk.Frame() frame.add(sw) vbox.add(frame) save_button = gtk.Button("Save As") save_button.connect("clicked", self.save, self.textview) hbox = gtk.HBox() hbox.pack_start(save_button, False) self.freeze_button = gtk.ToggleButton("_Disconnect") self.freeze_button.set_active(False) self.freeze_button.connect("toggled", self.freeze) searchbox = gtk.HBox() entry = gtk.Entry() entry.connect("activate", self.enter_clicked) searchbox.pack_start(entry, True) b = gtk.Button("Find Next") b.connect_object("clicked", self.on_find_clicked, entry) searchbox.pack_start(b, False) searchbox.pack_start(self.freeze_button, False) close_button = gtk.Button("_Close") close_button.connect("clicked", self.quit, None, None) help_button = gtk.Button("_Help") help_button.connect("clicked", helpwindow.capture) hbox.pack_end(close_button, False) hbox.pack_end(help_button, False) vbox.pack_start(searchbox, False) vbox.pack_start(hbox, False) self.window.add(vbox) close_button.grab_focus() self.window.show_all()
def userguide(w): window = gtk.Window() window.set_title("gcontrol Quick Guide") window.set_size_request(600, 600) window.set_icon(get_icon()) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) vbox = gtk.VBox() quit_button = gtk.Button("_Close") quit_button.connect("clicked", lambda x: window.destroy()) vbox.pack_start(sw) vbox.pack_start(quit_button, False) textview = gtk.TextView() textview.set_border_width(5) textview.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#fff")) textview.set_editable(False) sw.add(textview) window.add(vbox) tb = textview.get_buffer() textview.set_wrap_mode(gtk.WRAP_WORD) blue = tb.create_tag(None, foreground="blue") red = tb.create_tag(None, foreground="darkgreen") alert = tb.create_tag(None, foreground="red") bold = tb.create_tag(None, weight=pango.WEIGHT_BOLD) update_tb(tb, "gcontrol Suite Control GUI Quick Guide", [bold, blue]) update_tb(tb, "\n\nReal time cylc suite control and monitoring. " "See also 'cylc help' on the command line.") update_tb(tb, "\n\ngcontrol can display up to two of the following " "suite views at once: ") update_tb(tb, "dot ", [bold]) update_tb(tb, "(a quick visual overview ordered by cycle time), ") update_tb(tb, "text ", [bold]) update_tb(tb, "(with task message and timing information, and optional " "collapsible task families), ") update_tb(tb, "graph ", [bold]) update_tb(tb, " (showing the dependency structure of the suite, with " "collapsible task families).") update_tb(tb, "\n\nTask coloring ", [bold]) update_tb( tb, "indicates state: " "light blue=waiting, orange=submitted, green=running, " "gray=succeeded, red=failed, yellow=held, dark blue=runahead-held, " "purple=internal-queued. Additionally, in the graph view off-white " '"base graph" nodes are not currently represented by live proxies ' "in the running suite but are plotted just to complete the graph " "structure.", ) update_tb(tb, "\n\nRight-click on tasks in any view for task control " "and interrogation options.", [bold]) update_tb(tb, "\n\nMenu: File > ", [bold, red]) update_tb(tb, "\n o Exit: ", [bold]) update_tb(tb, "Exit the control GUI (does not shut the suite down).") update_tb(tb, "\n\nMenu: View > ", [bold, red]) update_tb(tb, "\n o Nudge Suite: ", [bold]) update_tb( tb, "Invoke the cylc task processing loop when nothing else " "is happening, in order to update estimated completion times " "(which are not yet shown in the graph-base GUI) and the " '"state last updated at" time in the status bar.', ) update_tb(tb, "\n o View Suite Log: ", [bold]) update_tb(tb, "View the cylc log for this suite, updating the view " "in real time if the suite is running.") update_tb(tb, "\n o View Suite Info: ", [bold]) update_tb(tb, "View the suite's description and task list.") update_tb(tb, "\n o (Graph View) Expand All Subtrees ", [bold]) update_tb(tb, "Expand any graph subtrees that you have " "collapsed via the right-click popup menu.") update_tb(tb, "\n o (Graph View) Time Range Focus ", [bold]) update_tb(tb, "Restrict display to a specified range of cycle times.") update_tb(tb, "\n o (Graph View) Toggle Graph Key ", [bold]) update_tb(tb, "Show or remove the dependency graph color key.") update_tb(tb, "\n o (Graph View) Toggle Crop Base Graph ", [bold]) update_tb( tb, "This controls whether or not the suite base " "graph (off-white coloured nodes) is plotted for tasks " "that are not currently present in the suite. Not plotting " "them may result in several apparently disconnected " "graph sections, but plotting them may not be advantageous " "if there are tasks with widely separated cycle times " "present.", ) update_tb(tb, "\n o Toggle Task Names ", [bold]) update_tb(tb, 'Show or remove task names in the upper "light panel" display.') update_tb(tb, "\n o Toggle Auto-Expand Tree ", [bold]) update_tb( tb, "If on, any cycle times containing submitted, running, or " "failed tasks will be automatically expanded whenever the suite " "state is updated.", ) update_tb(tb, "\n\nGraph view controls: ", [bold, red]) update_tb( tb, "Left-click to center the graph on a " "node; left-drag to pan; Zoom buttons, mouse-wheel, or " "ctrl-left-drag to zoom in and out, and shift-left-drag to " "zoom in on a box. " "Right-click on nodes for task control " "and interrogation options. ", [bold], ) update_tb( tb, "\n\nNOTE that the graph view may jump around as the suite evolves " "because the graphviz layout engine performs a new global optimization " "each time the graph is plotted. The 'DIS|REconnect' " "toggle button is provided to freeze the action temporarily. " "Time-zoom, collapse-tree, and task-filtering can also be used " "to focus on particular parts of a suite.", ) update_tb(tb, "\n\nMenu: Control > ", [bold, red]) update_tb(tb, "\n o Run Suite: ", [bold]) update_tb(tb, "Cold Start, Warm Start, Raw Start, or Restart the suite.") update_tb(tb, "\n o Stop Suite: ", [bold]) update_tb( tb, "Shut down the suite when all currently running tasks have finished " "or immediately (beware of orphaned tasks!), or after a all tasks have " "passed a given cycle time, or after a particular wall clock time, or " "after a particular task has finished.", ) update_tb(tb, "\n o Hold Suite (pause): ", [bold]) update_tb(tb, "Refrain from submitting tasks that are ready to run.") update_tb(tb, "\n o Release Suite (unpause): ", [bold]) update_tb(tb, "Resume submitting tasks that are ready to run.") update_tb(tb, "\n o Insert Task(s): ", [bold]) update_tb(tb, "Insert a task or task group into a running suite.") update_tb(tb, "\n o Block Access: ", [bold]) update_tb(tb, "Refuse to comply with subsequent intervention commands.") update_tb(tb, "\n o Unblock Access: ", [bold]) update_tb(tb, "Comply with subsequent intervention commands.") update_tb(tb, "\n o Change Runahead Limit: ", [bold]) update_tb(tb, "Change the suite's configured runahead limit at " "run time.") update_tb(tb, "\n\nRight-Click Task Popup Menu > ", [bold, red]) update_tb(tb, "\n o (Graph View) Collapse Subtree: ", [bold]) update_tb(tb, "Collapse everything downstream of this task into a single node.") update_tb(tb, "\n o (Graph View) Focus On YYYYMMDDHH: ", [bold]) update_tb(tb, "Restrict the graph to just the cycle time of this node (task).") update_tb(tb, "\n o (Graph View) Focus On Range: ", [bold]) update_tb(tb, "Restrict the graph to a specified range of cycle times.") update_tb(tb, "\n o (Graph View) Focus Reset: ", [bold]) update_tb(tb, "Reset any cycle time focusing and show the whole graph.") update_tb(tb, "\n o View Job Script: ", [bold]) update_tb(tb, "View the script used to submit this task to run.") update_tb(tb, "\n o View Output: ", [bold]) update_tb(tb, "View task stdout and stderr logs in real time.") update_tb(tb, "\n o View Task Info: ", [bold]) update_tb(tb, "View a task's description and the current state " "of its prerequisites and outputs.") update_tb(tb, "\n o View State: ", [bold]) update_tb(tb, "View the current state of a task's prerequisites " "and outputs.") update_tb(tb, "\n o Trigger: ", [bold]) update_tb( tb, "Set a task's prerequisites satisfied " "and, for clock-triggered tasks, ignore the trigger time. " "This will cause the task to trigger immediately (NOTE: " "if the suite is held (paused) the task will trigger when " "the hold is released).", ) update_tb(tb, "\n o Reset to 'ready': ", [bold]) update_tb( tb, "Set a task's prerequisites satisfied." "This is equivalent to 'Trigger' for non clock-triggered " "tasks (NOTE: if the suite is held (paused) the task will " "trigger when the hold is released).", ) update_tb(tb, "\n o Reset to 'waiting': ", [bold]) update_tb(tb, "Set all of a task's prerequisites unsatisfied.") update_tb(tb, "\n o Reset to 'succeeded': ", [bold]) update_tb(tb, "Set all of a task's outputs completed.") update_tb(tb, "\n o Reset to 'failed': ", [bold]) update_tb(tb, "Put the task in the 'failed' state.") update_tb(tb, "\n o Force Spawn: ", [bold]) update_tb(tb, "Force the task to spawn a successor if it hasn't done so already.") update_tb(tb, "\n o Hold: ", [bold]) update_tb(tb, "Put a task in the 'held' state; " "it won't run or spawn until released.") update_tb(tb, "\n o Release: ", [bold]) update_tb(tb, "Release a task from the 'held' state " "so that it can run again as normal.") update_tb(tb, "\n o Remove after spawning: ", [bold]) update_tb( tb, "Remove a task from the suite after forcing it to " "spawn a successor if it has not done so already." ) update_tb(tb, "\n o Remove without spawning: ", [bold]) update_tb( tb, "Remove a task from the suite even if it has not " "yet spawned a successor (in which case it will be removed " "permanently unless re-inserted).", ) update_tb(tb, "\n o Remove Tree (Recursive Purge): ", [bold]) update_tb( tb, "Remove a task from the suite, then remove any task " "that would depend on it, then remove any tasks that would depend on " "those tasks, and so on, through to a given stop cycle.", ) update_tb(tb, "\n o Add A Prerequisite: ", [bold]) update_tb( tb, "Here you can add a new prerequisite to a task at " "run time. Example of use: make a task wait on a one off task " "that it does not normally depend on but which has been " "inserted into the suite to handle some unusual situation.", ) window.show_all()
def __init__(self, main, my_id): tk.Toplevel.__init__(self, main) self.geometry('400x380' + main.get_child_window_position()) self.iconbitmap(util.get_icon(r.ICO_SIDE)) self.wm_protocol("WM_DELETE_WINDOW", lambda: self.quit()) self.minsize(350, 300) self.maxsize(main.winfo_width() - 30, main.winfo_height() - 70) self.transient(main) self.rowconfigure(2, weight=1) self.columnconfigure(0, weight=1) self.columnconfigure(1, weight=1) self.columnconfigure(2, weight=1) self.columnconfigure(3, weight=1) #self.columnconfigure(4, weight=1) self.title('Side-by-side comparision') self.bind('<Configure>', main.state_child) self.saved = True self.main = main self.report_list = {} self.valid_file_list(self.get_file_list()) self.output_name = tk.StringVar() # Loop of status bar messages msg = [ 'Select at least one HTML report to generate the side-by-side', 'Write a new to side-by-side file or select the auto generate', 'Only valid HTML report is presented in the list' ] self.main.status_bar.set_list(msg) # LABEL tk.Label(self, text='Select the html reports to a side by side comparison')\ .grid(row=1, column=0, columnspan=4, padx=10, pady=5, stick='w') tk.Label(self, text='Side-by-side file name')\ .grid(row=0, column=0, columnspan=2, pady=5, padx=2, stick='e') # ENTRY tk.Entry(self, textvariable=self.output_name) \ .grid(row=0, column=2, columnspan=2, pady=5, stick='we') # BUTTON self.img = util.get_image( r.IMG_SPARK) #tk.PhotoImage(file=r.IMG_SPARK) tk.Button(self, imag=self.img, command=lambda: self._get_title(main)) \ .grid(row=0, column=4, padx=(0, 10), sticky='w') # LISBOX self.list_values = tk.StringVar() self.list_box = tk.Listbox(self, listvariable=self.list_values, height=5, selectmode=tk.MULTIPLE) self.list_box.grid(row=2, column=0, columnspan=4, padx=(10, 0), stick='news') # SCROLBAR s = tk.Scrollbar(self, orient=tk.VERTICAL, command=self.list_box.yview) s.grid(row=2, column=4, padx=(0, 5), stick='ns') self.list_box.configure(yscrollcommand=s.set) # BUTTONS tk.Button(self, text='Clear selection', command=self.button_clear_selection)\ .grid(row=3, column=0, padx=(10,2), pady=10, stick='we') tk.Button(self, text='Select all', command=self.button_list_select_all)\ .grid(row=3, column=1, padx=2, pady=10, stick='we') tk.Button(self, text='Side by side report', command=self.button_report)\ .grid(row=3, column=2, padx=2, pady=10, stick='we') tk.Button(self,text='Close', command=self.quit)\ .grid(row=3, column=3, padx=2, pady=10, stick='we') # SIDEGRIP ttk.Sizegrip(self).grid(row=4, column=4, stick='e') list = [k for k in self.report_list.keys()] list.sort() self.list_values.set(list)
def __init__(self, parent, db, db_owner, tmpdir, pyro_timeout): self.db = db self.db_owner = db_owner if pyro_timeout: self.pyro_timeout = float(pyro_timeout) else: self.pyro_timeout = None self.regname = None self.updater = None self.tmpdir = tmpdir self.gcapture_windows = [] gobject.threads_init() #self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Dialog( "Choose a suite", parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) #self.window.set_modal(True) self.window.set_title("Suite Chooser") self.window.set_size_request(750, 400) self.window.set_icon( get_icon()) # TODO: not needed for a dialog window? #self.window.set_border_width( 5 ) self.window.connect("delete_event", self.delete_all_event) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.regd_treeview = gtk.TreeView() self.regd_treestore = gtk.TreeStore(str, str, str, str, str, str, str) self.regd_treeview.set_model(self.regd_treestore) self.regd_treeview.set_rules_hint(True) # search column zero (Ctrl-F) self.regd_treeview.connect('key_press_event', self.on_suite_select) self.regd_treeview.connect('button_press_event', self.on_suite_select) self.regd_treeview.set_search_column(0) # Start updating the liststore now, as we need values in it # immediately below (it may be possible to delay this till the # end of __init___() but it doesn't really matter. if self.db: self.dbopt = '--db=' + self.db else: self.dbopt = '' regd_ts = self.regd_treeview.get_selection() regd_ts.set_mode(gtk.SELECTION_SINGLE) cr = gtk.CellRendererText() #cr.set_property( 'cell-background', '#def' ) tvc = gtk.TreeViewColumn('Suite', cr, text=0, foreground=4, background=5) tvc.set_resizable(True) tvc.set_sort_column_id(0) self.regd_treeview.append_column(tvc) cr = gtk.CellRendererText() tvc = gtk.TreeViewColumn('Port', cr, text=1, foreground=4, background=5) tvc.set_resizable(True) # not sure how this sorting works #tvc.set_sort_column_id(1) self.regd_treeview.append_column(tvc) cr = gtk.CellRendererText() #cr.set_property( 'cell-background', '#def' ) tvc = gtk.TreeViewColumn('Title', cr, markup=2, foreground=4, background=6) tvc.set_resizable(True) #vc.set_sort_column_id(2) self.regd_treeview.append_column(tvc) cr = gtk.CellRendererText() tvc = gtk.TreeViewColumn('Location', cr, text=3, foreground=4, background=5) tvc.set_resizable(True) #vc.set_sort_column_id(3) self.regd_treeview.append_column(tvc) vbox = self.window.vbox sw.add(self.regd_treeview) vbox.pack_start(sw, True) self.selected_label_text = '(double-click or OK to select; right-click for db options)' self.selected_label = gtk.Label(self.selected_label_text) filter_entry = EntryTempText() filter_entry.set_width_chars(7) # Reduce width in toolbar filter_entry.connect("activate", self.filter) filter_entry.set_temp_text("filter") filter_toolitem = gtk.ToolItem() filter_toolitem.add(filter_entry) tooltip = gtk.Tooltips() tooltip.enable() tooltip.set_tip(filter_toolitem, "Filter suites \n(enter a sub-string or regex)") expand_button = gtk.ToolButton() image = gtk.image_new_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_SMALL_TOOLBAR) expand_button.set_icon_widget(image) expand_button.connect('clicked', lambda x: self.regd_treeview.expand_all()) collapse_button = gtk.ToolButton() image = gtk.image_new_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_SMALL_TOOLBAR) collapse_button.set_icon_widget(image) collapse_button.connect('clicked', lambda x: self.regd_treeview.collapse_all()) hbox = gtk.HBox() eb = gtk.EventBox() eb.add(self.selected_label) eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#bbc')) hbox.pack_start(eb, True) hbox.pack_start(expand_button, False) hbox.pack_start(collapse_button, False) hbox.pack_start(filter_toolitem, False) vbox.pack_start(hbox, False) self.window.show_all() self.start_updater()
def __init__(self, msg, parent=None): self.dialog = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, msg) self.dialog.set_icon(get_icon())
def __init__(self, command, stdoutfile, width=400, height=400, standalone=False, ignore_command=False, title=None): self.standalone = standalone self.command = command self.ignore_command = ignore_command self.stdout = stdoutfile self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(5) if title is None: self.window.set_title("Command Output") else: self.window.set_title(title) self.window.connect("delete_event", self.quit) self.window.set_default_size(width, height) self.window.set_icon(get_icon()) self.quit_already = False self.find_current = None self.find_current_iter = None self.search_warning_done = False sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) sw.show() self.textview = gtk.TextView() self.textview.set_editable(False) self.textview.set_wrap_mode(gtk.WRAP_WORD) # Use a monospace font. This is safe - by testing - setting an # illegal font description has no effect. self.textview.modify_font(pango.FontDescription("monospace")) tb = self.textview.get_buffer() self.textview.show() self.ftag = tb.create_tag(None, background="#70FFA9") self.warning_re = "WARNING" self.critical_re = "CRITICAL|ERROR" vbox = gtk.VBox() vbox.show() if not self.ignore_command: self.progress_bar = gtk.ProgressBar() self.progress_bar.set_text(command) self.progress_bar.set_pulse_step(0.04) self.progress_bar.show() vbox.pack_start(self.progress_bar, expand=False) self.command_label = gtk.Label(self.command) if self.ignore_command: self.command_label.show() vbox.pack_start(self.command_label, expand=False) sw.add(self.textview) frame = gtk.Frame() frame.add(sw) frame.show() vbox.add(frame) save_button = gtk.Button("Save As") save_button.connect("clicked", self.save, self.textview) save_button.show() hbox = gtk.HBox() hbox.pack_start(save_button, False) hbox.show() output_label = gtk.Label("output : " + stdoutfile.name) output_label.show() hbox.pack_start(output_label, expand=True) self.freeze_button = gtk.ToggleButton("_Disconnect") self.freeze_button.set_active(False) self.freeze_button.connect("toggled", self.freeze) self.freeze_button.show() searchbox = gtk.HBox() searchbox.show() entry = gtk.Entry() entry.show() entry.connect("activate", self.enter_clicked) searchbox.pack_start(entry, True) b = gtk.Button("Find Next") b.connect_object("clicked", self.on_find_clicked, entry) b.show() searchbox.pack_start(b, False) searchbox.pack_start(self.freeze_button, False) close_button = gtk.Button("_Close") close_button.connect("clicked", self.quit, None, None) close_button.show() hbox.pack_end(close_button, False) vbox.pack_start(searchbox, False) vbox.pack_start(hbox, False) self.window.add(vbox) close_button.grab_focus() self.window.show()
if self.hit(pt, item.full_extents): if self.hit(pt, item.text_extents): return (HIT_TEXT, item) elif self.hit(pt, item.button_extents): return (HIT_BUTTON, item) return (0, None) def OnEraseBackground(self, evt): pass def AddRoot(self, name, ctrl=None): if self.__root: raise Exception("CuttleTreeCtrl can only have one root item") else: self.__root = CuttleTreeItem(name) return self.__root if __name__ == "__main__": app = wx.PySimpleApp() frame = wx.Frame(None) tree = CuttleTreeCtrl(frame, style=CT_FULL_ROW_HIGHLIGHT) root = tree.AddRoot("Root item") tree.Expand(root) for x in range(4): item = tree.AppendItem(root, "Item %d" % x, icon=util.get_icon('book.png')) for y in range(3): tree.AppendItem(item, "Subitem %d" % y) frame.Show() app.MainLoop()
def __init__(self, msg, parent=None): self.dialog = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, msg) self.dialog.set_icon(get_icon())
def __init__(self, command, stdoutfile, width=400, height=400, standalone=False, ignore_command=False, title=None): self.standalone = standalone self.command = command self.ignore_command = ignore_command self.stdout = stdoutfile self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(5) if title is None: self.window.set_title('Command Output') else: self.window.set_title(title) self.window.connect("delete_event", self.quit) self.window.set_default_size(width, height) self.window.set_icon(get_icon()) self.quit_already = False self.find_current = None self.find_current_iter = None self.search_warning_done = False sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) sw.show() self.textview = gtk.TextView() self.textview.set_editable(False) self.textview.set_wrap_mode(gtk.WRAP_WORD) # Use a monospace font. This is safe - by testing - setting an # illegal font description has no effect. self.textview.modify_font(pango.FontDescription("monospace")) tb = self.textview.get_buffer() self.textview.show() self.ftag = tb.create_tag(None, background="#70FFA9") vbox = gtk.VBox() vbox.show() if not self.ignore_command: self.progress_bar = gtk.ProgressBar() self.progress_bar.set_text(command) self.progress_bar.set_pulse_step(0.04) self.progress_bar.show() vbox.pack_start(self.progress_bar, expand=False) self.command_label = gtk.Label(self.command) if self.ignore_command: self.command_label.show() vbox.pack_start(self.command_label, expand=False) sw.add(self.textview) frame = gtk.Frame() frame.add(sw) frame.show() vbox.add(frame) save_button = gtk.Button("Save As") save_button.connect("clicked", self.save, self.textview) save_button.show() hbox = gtk.HBox() hbox.pack_start(save_button, False) hbox.show() output_label = gtk.Label('output : ' + stdoutfile.name) output_label.show() hbox.pack_start(output_label, expand=True) self.freeze_button = gtk.ToggleButton("_Disconnect") self.freeze_button.set_active(False) self.freeze_button.connect("toggled", self.freeze) self.freeze_button.show() searchbox = gtk.HBox() searchbox.show() entry = gtk.Entry() entry.show() entry.connect("activate", self.enter_clicked) searchbox.pack_start(entry, True) b = gtk.Button("Find Next") b.connect_object('clicked', self.on_find_clicked, entry) b.show() searchbox.pack_start(b, False) searchbox.pack_start(self.freeze_button, False) close_button = gtk.Button("_Close") close_button.connect("clicked", self.quit, None, None) close_button.show() hbox.pack_end(close_button, False) vbox.pack_start(searchbox, False) vbox.pack_start(hbox, False) self.window.add(vbox) close_button.grab_focus() self.window.show()