def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'HelpMenu'. Crea un nuevo 'HelpMenu'. """ Menu.__init__(self) self._mwindow = p_mwindow root = os.path.abspath( os.path.join(__file__, os.pardir, os.pardir, os.pardir)) # OCTAVE Help oct_help = self.create_item("image", "_OCTAVE Help", os.path.join(root, "images", "help.png")) self.append(oct_help) oct_help.connect("activate", self.on_oct_help_activate) # Web Resources web_src = self.create_item("normal", "_Web Resources") self.append(web_src) web_src.set_submenu(WebSRCSubmenu(p_mwindow)) # Separator self.append(self.create_item("separator")) # About EIDMAT about = self.create_item("image", "_About EIDMAT", gtk.STOCK_ABOUT) self.append(about) about.connect("activate", self.on_about_activate)
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'WindowMenu'. Crea un nuevo 'WindowMenu'. """ Menu.__init__(self) self._mwindow = p_mwindow # Command Window cmdwindow_item = self.create_item("normal", "_0 Command Window") self.append(cmdwindow_item) cmdwindow_item.connect("activate", self.on_cmdwindow_activate) # Command History cmdhistory_item = self.create_item("normal", "_1 Command History") self.append(cmdhistory_item) cmdhistory_item.connect("activate", self.on_cmdhistory_activate) # Current Directory cdirectory_item = self.create_item("normal", "_2 Current Directory") self.append(cdirectory_item) cdirectory_item.connect("activate", self.on_cdirectory_activate) # Workspace wspace_item = self.create_item("normal", "_3 Workspace") self.append(wspace_item) wspace_item.connect("activate", self.on_wspace_activate)
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'EditMenu'. Crea un nuevo 'EditMenu'. """ Menu.__init__(self) self._mwindow = p_mwindow # Clear Command Window clear_cmdwindow = self.create_item("normal", "Clear Command _Window") self.append(clear_cmdwindow) clear_cmdwindow.connect("activate", self.on_clear_cmdwindow_activate) # Clear Command History clear_cmdhistory = self.create_item("normal", "Clear Command _History") self.append(clear_cmdhistory) clear_cmdhistory.connect("activate", self.on_clear_cmdhistory_activate) # Clear Workspace clear_wspace = self.create_item("normal", "Clear W_orkspace") self.append(clear_wspace) clear_wspace.connect("activate", self.on_clear_wspace_activate)
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'NewSubmenu'. Crea un nuevo 'NewSubmenu'. """ Menu.__init__(self) self._mwindow = p_mwindow root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir)) # Variable var_item = self.create_item("image", "_Variable", os.path.join(root, "images", "new_var.png")) self.append(var_item) var_item.connect("activate", self.on_var_activate) # M-File file_item = self.create_item("image", "M-F_ile", os.path.join(root, "images", "file.png")) self.append(file_item) file_item.connect("activate", self.on_file_activate)
def __init__(self, p_event, p_history): """ p_history: el 'Commandhistory'. p_event: el evento que provoco que se muestre el 'MenuHistory'. Retorna: un 'MenuHistory'. Crea un nuevo 'MenuHistory'. """ Menu.__init__(self) root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir)) self.__history = p_history # Evaluate Selection eval_item = self.create_item("normal", "_Evaluate Selection") eval_item.connect("activate", self.on_eval_activate) # Separator sep_item = self.create_item("separator") # Cut img = os.path.join(root, "images", "cut.png") cut_item = self.create_item("image", "Cu_t", img, "Ctrl+X") cut_item.connect("activate", self.on_cut_activate) # Copy img = os.path.join(root, "images", "copy.png") copy_item = self.create_item("image", "_Copy", img, "Ctrl+C") copy_item.connect("activate", self.on_copy_activate) # Delete delete_item = self.create_item("image", "_Delete", gtk.STOCK_DELETE) delete_item.connect("activate", self.on_delete_activate) # Delete to Selection delete_to_item = self.create_item("normal", "Delete _to Selection") delete_to_item.connect("activate", self.on_delete_to_activate) # Separator sep_item = self.create_item("separator") # Clear Command History clear_item = self.create_item("normal", "Clear Command _History") clear_item.connect("activate", self.on_clear_activate) count = p_history.get_selection().count_selected_rows() if not count: cut_item.set_sensitive(False) copy_item.set_sensitive(False) eval_item.set_sensitive(False) delete_item.set_sensitive(False) delete_to_item.set_sensitive(False) elif count > 1: delete_to_item.set_sensitive(False) Menu.popup(self, None, None, None, 3, p_event.time)
def __init__(self, p_event, p_tree_project): """ p_tree_project: el 'ThreeProject'. p_event: el evento que provoco que se muestre el 'MenuProyect'. Retorna: un 'MenuProyect'. Crea un nuevo 'MenuProyect'. """ Menu.__init__(self) root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir)) self.__tree_project = p_tree_project # Save img = os.path.join(root, "images", "save_project.png") save_item = self.create_item("image", "_Save", img) save_item.connect("activate", self.on_save_activate) # Save As img = os.path.join(root, "images", "save_project_as.png") save_as_item = self.create_item("image", "Save _As...", img) save_as_item.connect("activate", self.on_save_as_activate) # Delete img = os.path.join(root, "images", "delete.png") delete_item = self.create_item("image", "Delete Project", img) delete_item.connect("activate", self.on_delete_activate) # Separator sep_item = self.create_item("separator") # Import img = os.path.join(root, "images", "import_mfile.png") import_item = self.create_item("image", "_Import File", img) import_item.connect("activate", self.on_import_activate) # Separator sep_item = self.create_item("separator") # Close img = os.path.join(root, "images", "close_project.png") close_item = self.create_item("image", "_Close Project", img) close_item.connect("activate", self.on_close_activate) count = p_tree_project.get_selection().count_selected_rows() if not count: import_item.set_sensitive(False) save_item.set_sensitive(False) save_as_item.set_sensitive(False) delete_item.set_sensitive(False) import_item.set_sensitive(False) close_item.set_sensitive(False) Menu.popup(self, None, None, None, 3, p_event.time)
def __init__(self, p_wspace): """ p_wspace: un 'Workspace'. Retorna: un nuevo 'ListVarsMenu'. Crea un nuevo 'ListVarsMenu'. """ Menu.__init__(self) root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir)) # Save As self.__save_item = self.create_item("image", "Save _As...", gtk.STOCK_SAVE_AS) self.__save_item.connect("activate", self.on_save_activate) # Separator self.create_item("separator") # Copy img = os.path.join(root, "images", "copy.png") self.__copy_item = self.create_item("image", "_Copy", img, "Ctrl+C") self.__copy_item.connect("activate", self.on_copy_activate) # Duplicate self.__duplicate_item = self.create_item("normal", "D_uplicate", p_accel="Ctrl+D") self.__duplicate_item.connect("activate", self.on_duplicate_activate) # Delete img = os.path.join(root, "images", "delete_var.png") self.__delete_item = self.create_item("image", "_Delete", img) self.__delete_item.connect("activate", self.on_delete_activate) # Separator self.create_item("separator") # Rename self.__rename_item = self.create_item("normal", "_Rename...", p_accel="F2") self.__rename_item.connect("activate", self.on_rename_activate) # Separator self.create_item("separator") # New img = os.path.join(root, "images", "new_var.png") new_item = self.create_item("image", "_New", img, "Ctrl+N") new_item.connect("activate", self.on_new_activate) self.__workspace = p_wspace
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'EditorDebugMenu'. Crea un nuevo 'EditorDebugMenu'. """ Menu.__init__(self) # Save and Run self.__run_item = self.create_item("normal", "Save and _Run", None, "F5") self.insert(self.__run_item, 0)
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'FileMenu'. Crea un nuevo 'FileMenu'. """ Menu.__init__(self) self._mwindow = p_mwindow root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir)) # New new_item = self.create_item("image", "_New", os.path.join(root, "images", "new_file.png")) self.append(new_item) new_item.set_submenu(NewSubmenu(p_mwindow)) # Open self._open_item = self.create_item("image", "_Open...", os.path.join(root, "images", "open.png")) self.append(self._open_item) self._open_item.connect("activate", self.on_open_activate) # Separator self.append(self.create_item("separator")) # Import Data... import_item = self.create_item("normal", "_Import Data...") self.append(import_item) import_item.connect("activate", self.on_import_activate) # Save Workspace As... save_item = self.create_item("image", "Save _Workspace As...", os.path.join(root, "images", "save_workspace.png")) self.append(save_item) save_item.connect("activate", self.on_save_activate) # Separator self.append(self.create_item("separator")) # Exit EIDMAT exit_item = self.create_item("image", "E_xit EIDMAT", gtk.STOCK_QUIT) self.append(exit_item) exit_item.connect("activate", self.on_exit_activate)
def __init__(self, p_event, p_tree_project): """ p_tree_project: el 'TreeProject'. p_event: el evento que provoco que se muestre el 'TreeProject'. Retorna: un 'MenuMFile'. Crea un nuevo 'MenuMFile'. """ Menu.__init__(self) root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir)) self.__tree_project = p_tree_project # Evaluate Selection #eval_item = self.create_item("normal", "_Evaluate Selection") #eval_item.connect("activate", self.on_eval_activate) # Separator #sep_item = self.create_item("separator") # Edit img = os.path.join(root, "images", "cut.png") edit_item = self.create_item("image", "Edi_t", img) edit_item.connect("activate", self.on_edit_activate) # Delete delete_item = self.create_item("image", "_Delete", gtk.STOCK_DELETE) delete_item.connect("activate", self.on_delete_activate) # Separator sep_item = self.create_item("separator") count = p_tree_project.get_selection().count_selected_rows() if not count: edit_item.set_sensitive(False) eval_item.set_sensitive(False) delete_item.set_sensitive(False) Menu.popup(self, None, None, None, 3, p_event.time)
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'EditorTextMenu'. Crea un nuevo 'EditorTextMenu'. """ Menu.__init__(self) # Evaluate Selection self.__eval_item = self.create_item("normal", "_Evaluate Selection", None, "F9") self.insert(self.__eval_item, 0) # Separator self.insert(self.create_item("separator"), 1) # Comment self.__comment_item = self.create_item("normal", "_Comment") self.insert(self.__comment_item, 2) # UnComment self.__uncomment_item = self.create_item("normal", "_Uncomment") self.insert(self.__uncomment_item, 3) # Separator self.insert(self.create_item("separator"), 4) # Decrease Indent self.__decrease_item = self.create_item("normal", "_Decrease Indent") self.insert(self.__decrease_item, 5) # Increase Indent self.__increase_item = self.create_item("normal", "_Increase Indent") self.insert(self.__increase_item, 6) # Smart Indent self.__smart_item = self.create_item("normal", "_Smart Indent") self.insert(self.__smart_item, 7)
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'WebSRCSubmenu'. Crea un nuevo 'WebSRCSubmenu'. """ Menu.__init__(self) self._mwindow = p_mwindow # EIDMAT Web Site eidmat_site = self.create_item("normal", "_EIDMAT Web Site") self.append(eidmat_site) eidmat_site.connect("activate", self.on_eidmat_site_activate) # OCTAVE Web Site oct_site = self.create_item("normal", "O_CTAVE Web Site") self.append(oct_site) oct_site.connect("activate", self.on_oct_site_activate)
def create_item(self, p_type, p_text=None, p_stock=None, p_accel=None): """ p_type: una cadena que representa el tipo de elemento de menu a crear. 'p_type' puede ser "normal", "image", "check", "radio" o "separator". p_text: una cadena a mostrar por el elemento de menu. p_stock: una cadena que represente un 'stock de gtk' o una direccion de una imagen a mostrar por el elemento de menu. p_accel: una cadena que representa la combinacion de teclas que activa a dicho elemento de menu. 'p_accel' es lo ultimo que se muestra en el elemento de menu. Retorna: un 'gtk.MenuItem' en dependencia de los parametros dados. Crea, adiciona y retorna un elemento de menu segun los parametros dados. """ item = Menu.create_item(self, p_type, p_text, p_stock, p_accel) item.show_all() self.append(item) return item
def __init__(self, p_mwindow): """ p_mwindow: un 'MainWindow'. Retorna: un 'ProjectMenu'. Crea un nuevo 'ProjectMenu'. """ Menu.__init__(self) self._mwindow = p_mwindow root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir)) # New self.__new_item = self.create_item("image", "_New Project", os.path.join(root, "images", "new_project.png")) self.append(self.__new_item) self.__new_item.connect("activate", self.on_new_project_activate) # Open self.__open_item = self.create_item("image", "_Open Project", os.path.join(root, "images", "open_project.png")) self.append(self.__open_item) self.__open_item.connect("activate", self.on_open_project_activate) # Save self.__save_item = self.create_item("image", "_Save", os.path.join(root, "images", "save_project.png")) self.append(self.__save_item) self.__save_item.connect("activate", self.on_save_project_activate) self.__save_item.set_sensitive(False) # Save As self.__save_as_item = self.create_item("image", "Save _As...", os.path.join(root, "images", "save_project_as.png")) self.append(self.__save_as_item) self.__save_as_item.connect("activate", self.on_save_as_project_activate) self.__save_as_item.set_sensitive(False) # Delete self.__delete_item = self.create_item("image", "Delete Project", os.path.join(root, "images", "delete.png")) self.append(self.__delete_item) self.__delete_item.connect("activate", self.on_delete_project_activate) self.__delete_item.set_sensitive(False) # Separator self.append(self.create_item("separator")) # Import self.__import_item = self.create_item("image", "_Import File", os.path.join(root, "images", "import_mfile.png")) self.append(self.__import_item) self.__import_item.connect("activate", self.on_import_file_project_activate) self.__import_item.set_sensitive(False) # Separator self.append(self.create_item("separator")) # Close self.__close_item = self.create_item("image", "_Close Project", os.path.join(root, "images", "close_project.png")) self.append(self.__close_item) self.__close_item.connect("activate", self.on_close_project_activate) self.__close_item.set_sensitive(False)
def __init__(self, p_cmdwindow, p_event): """ p_cmdwindow: el 'CommandWindow'. p_event: el evento que provoco que se muestre el 'CommandWindowMenu'. Retorna: un 'CommandWindowMenu'. Crea un nuevo 'CommandWindowMenu'. """ Menu.__init__(self) root = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir)) self.__command_win = p_cmdwindow self.__event = p_event selection = p_cmdwindow.get_buffer().get_selection_bounds() # Evaluate Selection eval_item = self.create_item("normal", "_Evaluate Selection", p_accel="F9") eval_item.connect("activate", self.on_eval_activate) # Separator self.create_item("separator") # Cut img = os.path.join(root, "images", "cut.png") cut_item = self.create_item("image", "Cu_t", img, "Ctrl+X") cut_item.connect("activate", self.on_cut_activate) # Copy img = os.path.join(root, "images", "copy.png") copy_item = self.create_item("image", "_Copy", img, "Ctrl+C") copy_item.connect("activate", self.on_copy_activate) # Paste img = os.path.join(root, "images", "paste.png") paste_item = self.create_item("image", "_Paste", img, "Ctrl+V") paste_item.connect("activate", self.on_paste_activate) # Delete delete_item = self.create_item("image", "_Delete", gtk.STOCK_DELETE) delete_item.connect("activate", self.on_delete_activate) # Separator self.create_item("separator") # Select All select_item = self.create_item("normal", "Select _All", p_accel="Ctrl+A") select_item.connect("activate", self.on_select_activate) # Separator self.create_item("separator") # Clear Command Window clear_item = self.create_item("normal", "Clear Command _Window", p_accel="Ctrl+L") clear_item.connect("activate", self.on_clear_activate) if self.get_clipboard("CLIPBOARD").wait_for_text() == None: paste_item.set_sensitive(False) if not selection: eval_item.set_sensitive(False) cut_item.set_sensitive(False) copy_item.set_sensitive(False) delete_item.set_sensitive(False) elif p_cmdwindow.get_selection_zone(selection) == -1: cut_item.set_sensitive(False) delete_item.set_sensitive(False) if p_event.type == gtk.gdk.BUTTON_PRESS: self.popup(None, None, None, 3, p_event.time) else: self.popup(None, None, self._func, 3, p_event.time)