Exemple #1
0
 def handle_macro_entry_activate(self, entry_widget, dialog, entries):
     for entry in entries.values():
         try:
             ast.literal_eval(entry.get_text())
         except (ValueError, EOFError, SyntaxError):
             break
     else:
         dialog.response(gtk.RESPONSE_OK)
Exemple #2
0
 def handle_macro_entry_activate(self, entry_widget, dialog, entries):
     for entry in entries.values():
         try:
             ast.literal_eval(entry.get_text())
         except (ValueError, EOFError, SyntaxError):
             break
     else:
         dialog.response(gtk.RESPONSE_OK)
Exemple #3
0
 def launch_new_config_dialog(self, root_directory):
     """Launch a dialog allowing naming of a new configuration."""
     existing_apps = os.listdir(root_directory)
     checker_function = lambda t: t not in existing_apps
     label = rose.config_editor.DIALOG_LABEL_CONFIG_CHOOSE_NAME
     ok_tip_text = rose.config_editor.TIP_CONFIG_CHOOSE_NAME
     err_tip_text = rose.config_editor.TIP_CONFIG_CHOOSE_NAME_ERROR
     dialog, container, name_entry = rose.gtk.dialog.get_naming_dialog(
         label, checker_function, ok_tip_text, err_tip_text
     )
     dialog.set_title(rose.config_editor.DIALOG_TITLE_CONFIG_CREATE)
     meta_hbox = gtk.HBox()
     meta_label = gtk.Label(rose.config_editor.DIALOG_LABEL_CONFIG_CHOOSE_META)
     meta_label.show()
     meta_entry = gtk.Entry()
     tip_text = rose.config_editor.TIP_CONFIG_CHOOSE_META
     meta_entry.set_tooltip_text(tip_text)
     meta_entry.connect("activate", lambda b: dialog.response(gtk.RESPONSE_ACCEPT))
     meta_entry.show()
     meta_hbox.pack_start(meta_label, expand=False, fill=False, padding=rose.config_editor.SPACING_SUB_PAGE)
     meta_hbox.pack_start(meta_entry, expand=False, fill=True, padding=rose.config_editor.SPACING_SUB_PAGE)
     meta_hbox.show()
     container.pack_start(meta_hbox, expand=False, fill=True, padding=rose.config_editor.SPACING_PAGE)
     response = dialog.run()
     name = None
     meta = None
     if name_entry.get_text():
         name = name_entry.get_text().strip().strip("/")
     if meta_entry.get_text():
         meta = meta_entry.get_text().strip()
     dialog.destroy()
     if response == gtk.RESPONSE_ACCEPT:
         return name, meta
     return None, None
Exemple #4
0
 def launch_new_config_dialog(self, root_directory):
     """Launch a dialog allowing naming of a new configuration."""
     existing_apps = os.listdir(root_directory)
     checker_function = lambda t: t not in existing_apps
     label = rose.config_editor.DIALOG_LABEL_CONFIG_CHOOSE_NAME
     ok_tip_text = rose.config_editor.TIP_CONFIG_CHOOSE_NAME
     err_tip_text = rose.config_editor.TIP_CONFIG_CHOOSE_NAME_ERROR
     dialog, container, name_entry = rose.gtk.dialog.get_naming_dialog(
         label, checker_function, ok_tip_text, err_tip_text)
     dialog.set_title(rose.config_editor.DIALOG_TITLE_CONFIG_CREATE)
     meta_hbox = gtk.HBox()
     meta_label = gtk.Label(
         rose.config_editor.DIALOG_LABEL_CONFIG_CHOOSE_META)
     meta_label.show()
     meta_entry = gtk.Entry()
     tip_text = rose.config_editor.TIP_CONFIG_CHOOSE_META
     meta_entry.set_tooltip_text(tip_text)
     meta_entry.connect("activate",
                        lambda b: dialog.response(gtk.RESPONSE_ACCEPT))
     meta_entry.show()
     meta_hbox.pack_start(meta_label,
                          expand=False,
                          fill=False,
                          padding=rose.config_editor.SPACING_SUB_PAGE)
     meta_hbox.pack_start(meta_entry,
                          expand=False,
                          fill=True,
                          padding=rose.config_editor.SPACING_SUB_PAGE)
     meta_hbox.show()
     container.pack_start(meta_hbox,
                          expand=False,
                          fill=True,
                          padding=rose.config_editor.SPACING_PAGE)
     response = dialog.run()
     name = None
     meta = None
     if name_entry.get_text():
         name = name_entry.get_text().strip().strip('/')
     if meta_entry.get_text():
         meta = meta_entry.get_text().strip()
     dialog.destroy()
     if response == gtk.RESPONSE_ACCEPT:
         return name, meta
     return None, None