def __init__(self): gladefile = os.path.join(Configuration.GLADEPATH, "edit_generic.glade") wtree = gtk.glade.XML(gladefile) self.window = wtree.get_widget("dialog_edit_generic") self.scrolledwindow_generic = wtree.get_widget("scrolledwindow_generic") self.label_path = wtree.get_widget("label_path") self.combobox_backups = wtree.get_widget("combobox_backups") signals = { "on_button_save_clicked" : self.on_button_save_clicked, "on_button_cancel_clicked" : self.on_button_cancel_clicked, "on_button_restore_version_clicked" : self.on_button_restore_version_clicked } wtree.signal_autoconnect(signals) # add on destroy to quit loop self.window.connect("destroy", self.on_destroy) self.text_view_source = GuiUtils.new_apache_sourceview() self.scrolledwindow_generic.add( self.text_view_source ) self.text_view_source.show() self.return_value = None
def __init__(self): gladefile = os.path.join(Configuration.GLADEPATH, "edit_generic.glade") wtree = gtk.glade.XML(gladefile) self.window = wtree.get_widget("dialog_edit_generic") self.scrolledwindow_generic = wtree.get_widget( "scrolledwindow_generic") self.label_path = wtree.get_widget("label_path") self.combobox_backups = wtree.get_widget("combobox_backups") signals = { "on_button_save_clicked": self.on_button_save_clicked, "on_button_cancel_clicked": self.on_button_cancel_clicked, "on_button_restore_version_clicked": self.on_button_restore_version_clicked } wtree.signal_autoconnect(signals) # add on destroy to quit loop self.window.connect("destroy", self.on_destroy) self.text_view_source = GuiUtils.new_apache_sourceview() self.scrolledwindow_generic.add(self.text_view_source) self.text_view_source.show() self.return_value = None
def __init__(self, parent=None): self.module = None self.create_new = True self.parent = parent gladefile = os.path.join(Configuration.GLADEPATH, "edit_module.glade") wtree = gtk.glade.XML(gladefile) self.window = wtree.get_widget("dialog_edit_module") #self.text_view_module_conf = wtree.get_widget("text_view_module_conf") self.notebook = wtree.get_widget("notebook") self.button_save = wtree.get_widget("button_save") self.error_area = wtree.get_widget("error_area") self.module_doc_button = wtree.get_widget("module_doc_button") self.label_module = wtree.get_widget("label_module") self.label_module_description = wtree.get_widget( "label_module_description") self.combobox_module_backups = wtree.get_widget( "combobox_module_backups") self.label_path = wtree.get_widget("label_path") self.combobox_module_backups.set_active(0) signals = { "on_button_save_clicked": self.on_button_save_clicked, "on_button_cancel_clicked": self.on_button_cancel_clicked, "on_module_doc_button_clicked": self.on_module_doc_button_clicked, "on_combobox_module_backups_changed": self.on_combobox_module_backups_changed, "on_button_restore_version_clicked": self.on_button_restore_version_clicked } wtree.signal_autoconnect(signals) # add on destroy to quit loop self.window.connect("destroy", self.on_destroy) self.text_view_module_conf = GuiUtils.new_apache_sourceview() self.text_view_module_conf.show() wtree.get_widget("text_view_module_conf_area").add( self.text_view_module_conf) #GuiUtils.change_button_label( self.module_doc_button, 'Documentation' ) GuiUtils.style_as_tooltip(self.error_area)
def __init__(self, father=None): self.father = father self.gladefile = Configuration.GLADEPATH + "/" + "edit_vhost.glade" self.xml = gtk.glade.XML(self.gladefile) # Create our dictionary and connect it dic = { "quit": self.quit, "on_ok": self.save, "on_cancel": self.close, "domain_name_updated": self.domain_name_updated, "custom_folder_toggled": self.custom_folder_toggled, } self.xml.signal_autoconnect(dic) self.xml.get_widget("custom_folder").set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) font_desc = pango.FontDescription("monospace") self.xml.get_widget("vhost_source").modify_font(font_desc) GuiUtils.style_as_tooltip(self.xml.get_widget("message_container"))
def __init__(self, father=None): self.father = father self.gladefile = Configuration.GLADEPATH + "/" + "edit_vhost.glade" self.xml = gtk.glade.XML(self.gladefile) #Create our dictionary and connect it dic = { "quit": self.quit, "on_ok": self.save, "on_cancel": self.close, "domain_name_updated": self.domain_name_updated, "custom_folder_toggled": self.custom_folder_toggled } self.xml.signal_autoconnect(dic) self.xml.get_widget('custom_folder').set_action( gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) font_desc = pango.FontDescription('monospace') self.xml.get_widget('vhost_source').modify_font(font_desc) GuiUtils.style_as_tooltip(self.xml.get_widget('message_container'))
def __init__ ( self, parent = None): self.module = None self.create_new = True self.parent = parent gladefile = os.path.join(Configuration.GLADEPATH, "edit_module.glade") wtree = gtk.glade.XML(gladefile) self.window = wtree.get_widget("dialog_edit_module") #self.text_view_module_conf = wtree.get_widget("text_view_module_conf") self.notebook = wtree.get_widget("notebook") self.button_save = wtree.get_widget("button_save") self.error_area = wtree.get_widget("error_area") self.module_doc_button = wtree.get_widget("module_doc_button") self.label_module = wtree.get_widget("label_module") self.label_module_description = wtree.get_widget("label_module_description") self.combobox_module_backups = wtree.get_widget("combobox_module_backups") self.label_path = wtree.get_widget("label_path") self.combobox_module_backups.set_active(0) signals = { "on_button_save_clicked" : self.on_button_save_clicked, "on_button_cancel_clicked" : self.on_button_cancel_clicked, "on_module_doc_button_clicked" : self.on_module_doc_button_clicked, "on_combobox_module_backups_changed" : self.on_combobox_module_backups_changed, "on_button_restore_version_clicked" : self.on_button_restore_version_clicked } wtree.signal_autoconnect(signals) # add on destroy to quit loop self.window.connect("destroy", self.on_destroy) self.text_view_module_conf = GuiUtils.new_apache_sourceview() self.text_view_module_conf.show() wtree.get_widget("text_view_module_conf_area").add(self.text_view_module_conf) #GuiUtils.change_button_label( self.module_doc_button, 'Documentation' ) GuiUtils.style_as_tooltip( self.error_area )
def __init__(self, parent=None): self.parent = parent self.plugins = [] self.vhost = None gladefile = os.path.join(Configuration.GLADEPATH, "edit_vhost.glade") wtree = gtk.glade.XML(gladefile) self.window = wtree.get_widget("dialog_edit_vhost") self.entry_domain = wtree.get_widget("entry_domain") self.entry_location = wtree.get_widget("entry_location") self.button_location = wtree.get_widget("button_location") self.treeview_domain = wtree.get_widget("treeview_domain") self.checkbutton_hosts = wtree.get_widget("checkbutton_hosts") self.label_hosts = wtree.get_widget("label_hosts") self.toolbutton_domain_add = wtree.get_widget("toolbutton_domain_add") self.toolbutton_domain_edit = wtree.get_widget( "toolbutton_domain_edit") self.toolbutton_domain_delete = wtree.get_widget( "toolbutton_domain_delete") self.combobox_vhost_backups = wtree.get_widget( "combobox_vhost_backups") self.notebook = wtree.get_widget("notebook") self.button_save = wtree.get_widget("button_save") self.error_area = wtree.get_widget("error_area") self.label_path = wtree.get_widget("label_path") self.message_text = wtree.get_widget("message_text") self.error_area = wtree.get_widget("error_area") self.treeview_menu = wtree.get_widget("treeview_menu") signals = { "on_toolbutton_domain_add_clicked": self.on_toolbutton_domain_add_clicked, "on_toolbutton_domain_edit_clicked": self.on_toolbutton_domain_edit_clicked, "on_toolbutton_domain_delete_clicked": self.on_toolbutton_domain_delete_clicked, "on_button_save_clicked": self.on_button_save_clicked, "on_button_cancel_clicked": self.on_button_cancel_clicked, "on_entry_domain_changed": self.on_entry_domain_changed, "on_button_location_clicked": self.on_button_location_clicked, "on_entry_domain_focus_out_event": self.on_entry_domain_focus_out_event, "on_button_location_clear_clicked": self.on_button_location_clear_clicked, "on_button_restore_version_clicked": self.on_button_restore_version_clicked, "on_linkbutton_documentation_clicked": self.on_linkbutton_documentation_clicked, "on_notebook_switch_page": self.on_notebook_switch_page, "on_treeview_menu_cursor_changed": self.on_treeview_menu_cursor_changed, "on_button_error_close_clicked": self.on_button_error_close_clicked } wtree.signal_autoconnect(signals) # add on destroy to quit loop self.window.connect("destroy", self.on_destroy) self.combobox_vhost_backups.set_active(0) self.text_view_vhost_source = GuiUtils.new_apache_sourceview() wtree.get_widget('text_view_vhost_source_area').add( self.text_view_vhost_source) self.text_view_vhost_source.show() # Setup tree column = gtk.TreeViewColumn(('Domains')) column.set_spacing(4) cell = gtk.CellRendererText() column.pack_start(cell, True) column.set_attributes(cell, markup=0) self.treeview_domain.append_column(column) self.treeview_domain_store = gtk.ListStore(str, object) self.treeview_domain.set_model(self.treeview_domain_store) GuiUtils.style_as_tooltip(self.error_area) self.on_entry_domain_changed() #Setup Menu Tree column = gtk.TreeViewColumn(('Icon')) column.set_spacing(4) cell = gtk.CellRendererPixbuf() column.pack_start(cell, expand=False) column.set_attributes(cell, pixbuf=0) self.treeview_menu.append_column(column) column = gtk.TreeViewColumn(('Title')) column.set_spacing(4) cell = gtk.CellRendererText() column.pack_start(cell, True) column.set_attributes(cell, markup=1) self.treeview_menu.append_column(column) store = gtk.ListStore(gtk.gdk.Pixbuf, str, int) self.treeview_menu.set_model(store) icon_theme = gtk.icon_theme_get_default() store.append((icon_theme.lookup_icon("applications-internet", 24, 0).load_icon(), "Domain", 0)) # init enabled plugins for plugin in self.parent.plugin_manager.plugins: try: if plugin.is_enabled(): content, title, pixbuf = plugin.init_vhost_properties() tab_count = self.notebook.get_n_pages() - 1 plugin._tab_number = self.notebook.insert_page( content, gtk.Label(title), tab_count) store.append((pixbuf, title, tab_count)) content.show() self.plugins.append(plugin) except Exception: traceback.print_exc(file=sys.stdout) store.append((icon_theme.load_icon(gtk.STOCK_EDIT, 24, 0), "Definition File", self.notebook.get_n_pages() - 1)) select = self.treeview_menu.get_selection() select.select_path(0) self.__previous_active_tab = 0 self.accel_group = gtk.AccelGroup() self.window.add_accel_group(self.accel_group) self.button_save.add_accelerator("clicked", self.accel_group, 13, 0, 0) self.vhost = VirtualHostModel("")
def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) Master.register(self) self.denormalized_virtual_hosts = {} self.plugin_manager = PluginManager() self.apache = Apache2() #gnome.init(APPNAME, APPVERSION) self.gladefile = Configuration.GLADEPATH + "/" + "main.glade" self.xml = gtk.glade.XML(self.gladefile) #Create our dictionary and connect it dic = { "new_button_clicked": self.new_button_clicked, "on_MainWindow_destroy": self.quit, "please_restart": self.restart_apache, "on_delete": self.delete_button_clicked, "edit_button_clicked": self.edit_button_clicked, "edit_module_button_clicked": self.edit_module_button_clicked, "browse_sites_available": self.browse_sites_available, "on_button_resolve_errors_clicked": self.fix_vhosts, "surf_this_button_clicked": self.surf_this, "browse_button_clicked": self.browse_this, "about_clicked": self.display_about, "open_doc_button_clicked": self.open_doc_button_clicked, "on_button_hide_warning_clicked": self.on_button_hide_warning_clicked, "quit": self.quit, "on_menuitem_stop_apache_activate": self.on_menuitem_stop_apache_activate, "on_button_open_log_clicked": self.on_button_open_log_clicked } gtk.window_set_default_icon_from_file( os.path.join(Configuration.GLADEPATH, 'icon_cadsoft_eagle_golden.svg')) self.xml.signal_autoconnect(dic) GuiUtils.change_button_label(self.xml.get_widget('restart_apache'), "Restart Apache") #GuiUtils.change_button_label ( self.xml.get_widget( 'fix_vhosts' ), "Fix Virtual Hosts" ) self.statusbar_server_status = self.xml.get_widget( 'statusbar_server_status') self.image_apache_status = self.xml.get_widget('image_apache_status') self.main_window = self.xml.get_widget("MainWindow") self.menuitem_stop_apache = self.xml.get_widget("menuitem_stop_apache") self.menuitem_start_apache = self.xml.get_widget( "menuitem_start_apache") self.menuitem_restart_apache = self.xml.get_widget( "menuitem_restart_apache") #hereby we create lists self.create_vhost_list() self.create_modules_list() self.create_errors_list() #hereby we fill them self.refresh_lists(False) GuiUtils.style_as_tooltip(self.xml.get_widget('restart_apache_notice')) #GuiUtils.style_as_tooltip( self.xml.get_widget( 'unnormalized_notice' ) ) #GuiUtils.style_as_tooltip( self.xml.get_widget( 'hbox_apache_config_error' ) ) # start status update self.statusbar_server_status_context_id = self.statusbar_server_status.get_context_id( "Apache Server Status") self.statusbar_server_status.push( self.statusbar_server_status_context_id, "Attempting to connect to server") self.update_server_status(True) self.menu_tools = self.xml.get_widget('menu_tools') for plugin in self.plugin_manager.plugins: try: if plugin.is_enabled(): menu_item = plugin.init_main_window(self) if menu_item != None: self.menu_tools.add(menu_item) menu_item.show() except Exception: traceback.print_exc(file=sys.stdout) # Add rich edit to log self.text_view_log = GuiUtils.new_apache_sourceview() self.xml.get_widget('scroll_window_log').add(self.text_view_log) self.text_view_log.show() combobox_log = self.xml.get_widget('combobox_log') files = Shell.command.listdir("/var/log/apache2") for file in files: if file.endswith(".log"): combobox_log.append_text(file) combobox_log.set_active(0)
def __init__ ( self, parent = None): self.parent = parent self.plugins = [] self.vhost = None gladefile = os.path.join(Configuration.GLADEPATH, "edit_vhost.glade") wtree = gtk.glade.XML(gladefile) self.window = wtree.get_widget("dialog_edit_vhost") self.entry_domain = wtree.get_widget("entry_domain") self.entry_location = wtree.get_widget("entry_location") self.button_location = wtree.get_widget("button_location") self.treeview_domain = wtree.get_widget("treeview_domain") self.checkbutton_hosts = wtree.get_widget("checkbutton_hosts") self.label_hosts = wtree.get_widget("label_hosts") self.toolbutton_domain_add = wtree.get_widget("toolbutton_domain_add") self.toolbutton_domain_edit = wtree.get_widget("toolbutton_domain_edit") self.toolbutton_domain_delete = wtree.get_widget("toolbutton_domain_delete") self.combobox_vhost_backups = wtree.get_widget("combobox_vhost_backups") self.notebook = wtree.get_widget("notebook") self.button_save = wtree.get_widget("button_save") self.error_area = wtree.get_widget("error_area") self.label_path = wtree.get_widget("label_path") self.message_text = wtree.get_widget("message_text") self.error_area = wtree.get_widget("error_area") self.treeview_menu = wtree.get_widget("treeview_menu") signals = { "on_toolbutton_domain_add_clicked" : self.on_toolbutton_domain_add_clicked, "on_toolbutton_domain_edit_clicked" : self.on_toolbutton_domain_edit_clicked, "on_toolbutton_domain_delete_clicked": self.on_toolbutton_domain_delete_clicked, "on_button_save_clicked" : self.on_button_save_clicked, "on_button_cancel_clicked" : self.on_button_cancel_clicked, "on_entry_domain_changed" : self.on_entry_domain_changed, "on_button_location_clicked" : self.on_button_location_clicked, "on_entry_domain_focus_out_event" : self.on_entry_domain_focus_out_event, "on_button_location_clear_clicked" : self.on_button_location_clear_clicked, "on_button_restore_version_clicked" : self.on_button_restore_version_clicked, "on_linkbutton_documentation_clicked" : self.on_linkbutton_documentation_clicked, "on_notebook_switch_page" : self.on_notebook_switch_page, "on_treeview_menu_cursor_changed" : self.on_treeview_menu_cursor_changed, "on_button_error_close_clicked" : self.on_button_error_close_clicked } wtree.signal_autoconnect(signals) # add on destroy to quit loop self.window.connect("destroy", self.on_destroy) self.combobox_vhost_backups.set_active(0) self.text_view_vhost_source = GuiUtils.new_apache_sourceview() wtree.get_widget( 'text_view_vhost_source_area' ).add( self.text_view_vhost_source ) self.text_view_vhost_source.show() # Setup tree column = gtk.TreeViewColumn(('Domains')) column.set_spacing(4) cell = gtk.CellRendererText() column.pack_start(cell, True) column.set_attributes(cell, markup=0) self.treeview_domain.append_column(column) self.treeview_domain_store = gtk.ListStore(str, object) self.treeview_domain.set_model(self.treeview_domain_store) GuiUtils.style_as_tooltip( self.error_area ) self.on_entry_domain_changed() #Setup Menu Tree column = gtk.TreeViewColumn(('Icon')) column.set_spacing(4) cell = gtk.CellRendererPixbuf() column.pack_start(cell, expand=False) column.set_attributes(cell, pixbuf=0) self.treeview_menu.append_column(column) column = gtk.TreeViewColumn(('Title')) column.set_spacing(4) cell = gtk.CellRendererText() column.pack_start(cell, True) column.set_attributes(cell, markup=1) self.treeview_menu.append_column(column) store = gtk.ListStore(gtk.gdk.Pixbuf, str, int) self.treeview_menu.set_model(store) icon_theme = gtk.icon_theme_get_default() store.append((icon_theme.lookup_icon("applications-internet", 24, 0).load_icon(), "Domain", 0)) # init enabled plugins for plugin in self.parent.plugin_manager.plugins: try: if plugin.is_enabled(): content, title, pixbuf = plugin.init_vhost_properties() tab_count = self.notebook.get_n_pages() - 1 plugin._tab_number = self.notebook.insert_page(content, gtk.Label(title), tab_count) store.append((pixbuf, title, tab_count)) content.show() self.plugins.append(plugin) except Exception: traceback.print_exc(file=sys.stdout) store.append((icon_theme.load_icon(gtk.STOCK_EDIT, 24, 0), "Definition File", self.notebook.get_n_pages() - 1)) select = self.treeview_menu.get_selection() select.select_path(0) self.__previous_active_tab = 0 self.accel_group = gtk.AccelGroup() self.window.add_accel_group(self.accel_group) self.button_save.add_accelerator("clicked", self.accel_group, 13, 0, 0) self.vhost = VirtualHostModel( "")
def __init__(self, *args, **kwargs): super (MainWindow, self).__init__ (*args, **kwargs) Master.register(self) self.denormalized_virtual_hosts = {} self.plugin_manager = PluginManager() self.apache = Apache2() #gnome.init(APPNAME, APPVERSION) self.gladefile = Configuration.GLADEPATH + "/" + "main.glade" self.xml = gtk.glade.XML(self.gladefile) #Create our dictionary and connect it dic = { "new_button_clicked" : self.new_button_clicked, "on_MainWindow_destroy" : self.quit , "please_restart" : self.restart_apache , "on_delete" : self.delete_button_clicked, "edit_button_clicked" : self.edit_button_clicked, "edit_module_button_clicked" : self.edit_module_button_clicked, "browse_sites_available" : self.browse_sites_available, "on_button_resolve_errors_clicked" : self.fix_vhosts, "surf_this_button_clicked" : self.surf_this, "browse_button_clicked" : self.browse_this, "about_clicked" : self.display_about, "open_doc_button_clicked" : self.open_doc_button_clicked, "on_button_hide_warning_clicked" : self.on_button_hide_warning_clicked, "quit" : self.quit, "on_menuitem_stop_apache_activate" : self.on_menuitem_stop_apache_activate, "on_button_open_log_clicked" : self.on_button_open_log_clicked } gtk.window_set_default_icon_from_file(os.path.join( Configuration.GLADEPATH, 'icon_cadsoft_eagle_golden.svg')) self.xml.signal_autoconnect(dic) GuiUtils.change_button_label ( self.xml.get_widget( 'restart_apache' ), "Restart Apache" ) #GuiUtils.change_button_label ( self.xml.get_widget( 'fix_vhosts' ), "Fix Virtual Hosts" ) self.statusbar_server_status = self.xml.get_widget( 'statusbar_server_status' ) self.image_apache_status = self.xml.get_widget( 'image_apache_status' ) self.main_window = self.xml.get_widget("MainWindow") self.menuitem_stop_apache = self.xml.get_widget("menuitem_stop_apache") self.menuitem_start_apache = self.xml.get_widget("menuitem_start_apache") self.menuitem_restart_apache = self.xml.get_widget("menuitem_restart_apache") #hereby we create lists self.create_vhost_list() self.create_modules_list() self.create_errors_list() #hereby we fill them self.refresh_lists(False) GuiUtils.style_as_tooltip( self.xml.get_widget( 'restart_apache_notice' ) ) #GuiUtils.style_as_tooltip( self.xml.get_widget( 'unnormalized_notice' ) ) #GuiUtils.style_as_tooltip( self.xml.get_widget( 'hbox_apache_config_error' ) ) # start status update self.statusbar_server_status_context_id = self.statusbar_server_status.get_context_id("Apache Server Status") self.statusbar_server_status.push(self.statusbar_server_status_context_id, "Attempting to connect to server") self.update_server_status(True) self.menu_tools = self.xml.get_widget( 'menu_tools' ) for plugin in self.plugin_manager.plugins: try: if plugin.is_enabled(): menu_item = plugin.init_main_window(self) if menu_item != None: self.menu_tools.add(menu_item) menu_item.show() except Exception: traceback.print_exc(file=sys.stdout) # Add rich edit to log self.text_view_log = GuiUtils.new_apache_sourceview() self.xml.get_widget( 'scroll_window_log' ).add( self.text_view_log ) self.text_view_log.show() combobox_log = self.xml.get_widget( 'combobox_log' ) files = Shell.command.listdir("/var/log/apache2") for file in files: if file.endswith(".log"): combobox_log.append_text(file) combobox_log.set_active(0)