[SCM] GUI front-end for Debian Live. branch, master, updated. 72023d3200637edc6b81b8cc8d240b376a0d14df
Chris Lamb
chris at chris-lamb.co.uk
Wed Jul 9 23:14:02 UTC 2008
The following commit has been merged in the master branch:
commit 501b6dda7e4a051c14d92d9d330358eeda357e44
Author: Chris Lamb <chris at chris-lamb.co.uk>
Date: Wed Jul 9 23:55:57 2008 +0100
Misc cleanups.
Signed-off-by: Chris Lamb <chris at chris-lamb.co.uk>
diff --git a/LiveMagic/controllers/__init__.py b/LiveMagic/controllers/__init__.py
index a469efa..0d9a41a 100644
--- a/LiveMagic/controllers/__init__.py
+++ b/LiveMagic/controllers/__init__.py
@@ -1,13 +1,11 @@
from build import BuildController as Build
from main import MainController as Main
-from hooks import HooksController as Hooks
from wizard import WizardController as Wizard
-class Controller(Main, Build, Hooks, Wizard):
+class Controller(Main, Build, Wizard):
def __init__(self):
self.model = None
Main.__init__(self)
Build.__init__(self)
- Hooks.__init__(self)
Wizard.__init__(self)
diff --git a/LiveMagic/controllers/hooks.py b/LiveMagic/controllers/hooks.py
deleted file mode 100644
index edc6d4a..0000000
--- a/LiveMagic/controllers/hooks.py
+++ /dev/null
@@ -1,85 +0,0 @@
-
-class HooksController(object):
- def __init__(self):
- #self.model.attach_load_observer(self.notify_load_hooks)
- self.hook_select_triggers_change = True
-
- def on_hook_select(self, *_):
- self.hook_select_triggers_change = False
- hook_name = self.view.get_selected_hook()
- contents = self.model.hooks[hook_name]
- self.view.do_set_selected_hook_contents(contents)
- self.hook_select_triggers_change = True
-
- def notify_load_hooks(self):
- self.view.do_hooks_clear()
- for filename in sorted(self.model.hooks.files.iterkeys()):
- self.view.do_hook_add(filename)
-
- def _new_hook_template(self, hook_name):
- # Try and guess the interpreter for the specified filename
- try:
- interpreter = {
- "rb" : "#!/usr/bin/env ruby",
- "pl" : "#!/usr/bin/perl",
- "py" : "#!/usr/bin/env python",
- }[hook_name.rsplit(".")[1]]
- except:
- # Can't guess: assume it's a shell script.
- interpreter = "#!/bin/sh"
-
- return "%s\n\n# %s -- description_of_hook\n\n" % (interpreter, hook_name)
-
- def on_button_hook_new_clicked(self, *_):
- hook_name = self.view.do_show_new_hook_window()
- if hook_name is not None:
- if len(hook_name) > 0 and hook_name not in self.model.hooks:
- self.model.hooks[hook_name] = self._new_hook_template(hook_name)
- self.view.set_save_enabled(True)
- self.notify_load_hooks()
- self.view.do_set_selected_hook(hook_name)
- self.view.do_set_selected_hook_contents(self.model.hooks[hook_name])
- else:
- self.view.do_show_error("The name you specified is invalid")
-
- def on_button_hook_import_clicked(self, *_):
- filename = self.view.do_show_hook_import_dialog()
- if filename is not None:
- hook_name = self.model.hooks.import_file(filename)
- self.notify_load_hooks()
- self.view.do_set_selected_hook(hook_name)
- self.view.set_save_enabled(True)
-
- def on_button_hook_rename_clicked(self, *_):
- hook_name = self.view.get_selected_hook()
- new_hook_name = self.view.do_show_rename_hook_window(hook_name)
-
- if new_hook_name is None:
- return
-
- try:
- self.model.hooks.rename(hook_name, new_hook_name)
- self.notify_load_hooks()
- self.view.do_set_selected_hook(new_hook_name)
- self.view.set_save_enabled(True)
- except ValueError:
- self.view.do_show_error("The name already exists")
-
- def on_button_hook_delete_clicked(self, *_):
- ret = self.view.do_show_hook_delete_confirm_window()
- if not ret:
- return
-
- hook_name = self.view.get_selected_hook()
- self.model.hooks.delete(hook_name)
- self.notify_load_hooks()
- self.view.do_clear_hook_contents()
- self.view.do_enable_edit_hook(False)
- self.view.set_save_enabled(True)
-
- def on_hook_editor_changed(self, *_):
- if self.hook_select_triggers_change:
- self.view.set_save_enabled(True)
- hook = self.view.get_selected_hook()
- if hook is not None:
- self.model.hooks[hook] = self.view.get_hook_editor_contents()
diff --git a/LiveMagic/views/__init__.py b/LiveMagic/views/__init__.py
index 3353670..bc70066 100644
--- a/LiveMagic/views/__init__.py
+++ b/LiveMagic/views/__init__.py
@@ -1,13 +1,12 @@
from build import BuildView as Build
from main import MainView as Main
-from hooks import HooksView as Hooks
from wizard import WizardView as Wizard
from LiveMagic.utils import find_resource
import gtk.glade
-class View(Main, Build, Hooks, Wizard):
+class View(Main, Build, Wizard):
def __init__(self, controller):
self.controller = controller
@@ -16,5 +15,4 @@ class View(Main, Build, Hooks, Wizard):
Main.__init__(self)
Build.__init__(self)
- Hooks.__init__(self)
Wizard.__init__(self)
diff --git a/LiveMagic/views/hooks.py b/LiveMagic/views/hooks.py
deleted file mode 100644
index a779941..0000000
--- a/LiveMagic/views/hooks.py
+++ /dev/null
@@ -1,180 +0,0 @@
-import gtk
-import gobject
-import pango
-import mimetypes
-
-class HooksView(object):
- def __init__(self):
- # Configure the hook combo box
- hbox = self['hbox_hooks']
- self.cb = gtk.combo_box_new_text()
- self.cb.show()
- self.cb.connect("changed", self.controller.on_hook_select)
- hbox.pack_start(self.cb)
- hbox.reorder_child(self.cb, 0)
-
- # Configure editor
- try:
- from gtksourceview import SourceBuffer, SourceView
- buffer = SourceBuffer()
- self.hook_editor = SourceView(buffer)
- self.hook_editor.set_show_line_numbers(True)
- buffer.set_highlight(True)
- except ImportError:
- self.hook_editor = gtk.TextView()
-
- font_desc = pango.FontDescription('Monospace 8')
- if font_desc:
- self.hook_editor.modify_font(font_desc)
-
- self.hook_editor.get_buffer().connect("changed", self.controller.on_hook_editor_changed)
-
- self['scroll_hook_edit'].add_with_viewport(self.hook_editor)
- self.do_enable_edit_hook(False)
- self.hook_editor.show()
-
- def do_show_new_hook_window(self):
- dialog = gtk.Dialog(
- "Choose filename",
- self['window_main'],
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- ( gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
-
- entry = gtk.Entry(256)
- entry.connect("activate", lambda _: dialog.action_area.get_children()[1].clicked())
-
- dialog.vbox.pack_start(entry, padding=10)
- dialog.vbox.show_all()
- res = dialog.run()
- dialog.destroy()
-
- if res == gtk.RESPONSE_ACCEPT:
- return entry.get_text().strip()
- else:
- return None
-
- def do_show_rename_hook_window(self, old_hook_name):
- dialog = gtk.Dialog(
- "Choose new name for %s" % old_hook_name,
- self['window_main'],
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- ( gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
-
- entry = gtk.Entry(256)
- entry.connect("activate", lambda _: dialog.action_area.get_children()[1].clicked())
-
- dialog.vbox.pack_start(entry, padding=10)
- dialog.vbox.show_all()
- res = dialog.run()
- dialog.destroy()
-
- if res == gtk.RESPONSE_ACCEPT:
- return entry.get_text().strip()
- else:
- return None
-
- def do_show_hook_import_dialog(self):
- dialog = gtk.FileChooserDialog(
- "Choose hook to import",
- self['window_main'],
- gtk.FILE_CHOOSER_ACTION_OPEN,
- (
- gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
-
- dialog.set_current_folder("/usr/share/live-helper/examples/hooks")
-
- res = dialog.run()
- filename = dialog.get_filename()
- dialog.destroy()
-
- if res == gtk.RESPONSE_ACCEPT:
- return filename
- else:
- return None
-
- def do_show_error(self, title):
- dialog = gtk.MessageDialog(
- self['window_main'],
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- gtk.MESSAGE_ERROR,
- gtk.BUTTONS_CLOSE,
- title,
- )
- dialog.run()
- dialog.destroy()
-
- def do_show_hook_delete_confirm_window(self):
- dialog = gtk.Dialog(
- "Are you sure?",
- self['window_main'],
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- ( gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
-
- res = dialog.run()
- dialog.destroy()
- return (res == gtk.RESPONSE_ACCEPT)
-
- def do_hook_add(self, filename):
- self.cb.append_text(filename)
-
- def get_selected_hook(self):
- filename = self.cb.get_active_text()
- return filename
-
- def do_hooks_clear(self):
- self.hook_editor.set_sensitive(False)
- for _ in xrange(len(self.cb.get_model())):
- self.cb.remove_text(0)
-
- def get_hook_editor_contents(self):
- buf = self.hook_editor.get_buffer()
- return buf.get_text(buf.get_start_iter(), buf.get_end_iter())
-
- def do_enable_edit_hook(self, enabled):
- self.cb.set_sensitive(enabled)
- self.hook_editor.set_sensitive(enabled)
- self['button_hook_rename'].set_sensitive(enabled)
- self['button_hook_delete'].set_sensitive(enabled)
-
- def do_set_selected_hook(self, hook_name):
- # Update combo box to reflect selection
- m = self.cb.get_model()
- iter = m.get_iter_first()
-
- while iter is not None:
- if hook_name == m.get_value(iter, 0):
- self.cb.set_active_iter(iter)
- return
- iter = m.iter_next(iter)
-
- def do_clear_hook_contents(self):
- buffer = self.hook_editor.get_buffer()
- buffer.begin_not_undoable_action()
- buffer.set_text("")
- buffer.end_not_undoable_action()
-
- def do_set_selected_hook_contents(self, contents):
- buffer = self.hook_editor.get_buffer()
- buffer.begin_not_undoable_action()
-
- # Set hook editor contents and allow editing
- buffer.set_text(contents)
- self.do_enable_edit_hook(True)
- self.hook_editor.grab_focus()
-
- buffer.end_not_undoable_action()
-
- # Set highlighting
- try:
- import gnomevfs
- from gtksourceview import SourceLanguagesManager
-
- mime_type = gnomevfs.get_mime_type_for_data(contents)
- lang = SourceLanguagesManager().get_language_from_mime_type(mime_type)
- buffer.set_language(lang)
- except ImportError:
- pass
diff --git a/README.Release b/README.Release
deleted file mode 100644
index 1c621d1..0000000
--- a/README.Release
+++ /dev/null
@@ -1,14 +0,0 @@
-=================
-Release checklist
-=================
-
- * debian/changelog
- - Update entries
- - Validate suit
- - Bump timestamp
-
- * setup.py
- - Bump version>
-
- * debian/manpages/live-helper.1
- - Bump date.
diff --git a/misc/live-magic-builder b/misc/live-magic-builder
index 31c1dff..933ddb8 100755
--- a/misc/live-magic-builder
+++ b/misc/live-magic-builder
@@ -36,7 +36,7 @@ Save_config () {
do
while read LINE
do
- echo "${FILE}: ${LINE}" | tee -a ${LOG}
+ echo "${FILE}: ${LINE}" >> ${LOG}
done < ${FILE}
done
}
diff --git a/misc/live-magic.desktop b/misc/live-magic.desktop
index ac39f1d..85c8caf 100644
--- a/misc/live-magic.desktop
+++ b/misc/live-magic.desktop
@@ -1,7 +1,6 @@
[Desktop Entry]
-Encoding=UTF-8
Type=Application
-Version=1.0
+Version=0.4
Name=Live Magic
Comment=Create Debian Live systems (LiveCDs, etc.)
Icon=/usr/share/live-magic/debian_openlogo-nd-100.png
--
GUI front-end for Debian Live.
More information about the debian-live-changes
mailing list