[Ocfs2-tools-commits] manish commits r760 - trunk/ocfs2console/ocfs2interface

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Mar 28 18:33:40 CST 2005


Author: manish
Date: 2005-03-28 18:33:38 -0600 (Mon, 28 Mar 2005)
New Revision: 760

Added:
   trunk/ocfs2console/ocfs2interface/terminal.py
Modified:
   trunk/ocfs2console/ocfs2interface/Makefile
   trunk/ocfs2console/ocfs2interface/fsck.py
Log:
Abstract out the terminal dialog window


Modified: trunk/ocfs2console/ocfs2interface/Makefile
===================================================================
--- trunk/ocfs2console/ocfs2interface/Makefile	2005-03-28 23:58:36 UTC (rev 759)
+++ trunk/ocfs2console/ocfs2interface/Makefile	2005-03-29 00:33:38 UTC (rev 760)
@@ -68,6 +68,7 @@
 	menu.py \
 	partitionview.py \
 	process.py \
+	terminal.py \
 	toolbar.py \
 	tune.py
 

Modified: trunk/ocfs2console/ocfs2interface/fsck.py
===================================================================
--- trunk/ocfs2console/ocfs2interface/fsck.py	2005-03-28 23:58:36 UTC (rev 759)
+++ trunk/ocfs2console/ocfs2interface/fsck.py	2005-03-29 00:33:38 UTC (rev 760)
@@ -16,19 +16,11 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
 
 import gobject
-import gtk
 
-from guiutil import set_props
+from terminal import TerminalDialog, terminal_ok as fsck_ok
 
 base_command = ('fsck.ocfs2',)
 
-try:
-    import vte
-except ImportError:
-    fsck_ok = False
-else:
-    fsck_ok = True
-
 def fsck_volume(parent, device, check=False):
     if check:
         check_str = 'check'
@@ -37,38 +29,15 @@
 
     title = 'File System ' + check_str.capitalize()
 
-    dialog = gtk.Dialog(parent=parent, title=title,
-                        buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+    dialog = TerminalDialog(parent=parent, title=title)
+    terminal = dialog.terminal
 
-    label = gtk.Label(title)
-    label.set_alignment(xalign=0.0, yalign=0.5)
-    dialog.vbox.pack_start(label)
-
-    frame = gtk.Frame()
-    frame.set_shadow_type(gtk.SHADOW_IN)
-    dialog.vbox.pack_end(frame)
-
-    hbox = gtk.HBox()
-    frame.add(hbox)
-
-    terminal = vte.Terminal()
-    terminal.set_scrollback_lines(8192)
-    #terminal.set_font_from_string('monospace 12')
-    hbox.pack_start(terminal)
-
-    scrollbar = gtk.VScrollbar()
-    scrollbar.set_adjustment(terminal.get_adjustment())
-    hbox.pack_end(scrollbar)
-
     dialog.finished = False
     terminal.connect('child-exited', child_exited, dialog)
 
-    dialog.pid = -1
     command = fsck_command(device, check)
     gobject.idle_add(start_command, terminal, command, dialog)
 
-    dialog.show_all()
-
     while 1:
         dialog.run()
 
@@ -110,7 +79,8 @@
     return ['/bin/sh', '-c', realcommand]
 
 def main():
-    fsck_volume(None, '/dev/sdb1', check=True)
+    import sys
+    fsck_volume(None, sys.argv[1], check=True)
 
 if __name__ == '__main__':
     main()

Added: trunk/ocfs2console/ocfs2interface/terminal.py
===================================================================
--- trunk/ocfs2console/ocfs2interface/terminal.py	2005-03-28 23:58:36 UTC (rev 759)
+++ trunk/ocfs2console/ocfs2interface/terminal.py	2005-03-29 00:33:38 UTC (rev 760)
@@ -0,0 +1,61 @@
+# OCFS2Console - GUI frontend for OCFS2 management and debugging
+# Copyright (C) 2005 Oracle.  All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
+
+import gtk
+
+from guiutil import set_props
+
+try:
+    import vte
+except ImportError:
+    terminal_ok = False
+else:
+    terminal_ok = True
+
+class TerminalDialog(gtk.Dialog):
+    def __init__(self, parent=None, title='Terminal'):
+        gtk.Dialog.__init__(self, parent=parent, title=title,
+                            buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+
+        label = gtk.Label(title)
+        label.set_alignment(xalign=0.0, yalign=0.5)
+        self.vbox.pack_start(label)
+
+        frame = gtk.Frame()
+        frame.set_shadow_type(gtk.SHADOW_IN)
+        self.vbox.pack_end(frame)
+
+        hbox = gtk.HBox()
+        frame.add(hbox)
+
+        self.terminal = vte.Terminal()
+        self.terminal.set_scrollback_lines(8192)
+        #self.terminal.set_font_from_string('monospace 12')
+        hbox.pack_start(self.terminal)
+
+        scrollbar = gtk.VScrollbar()
+        scrollbar.set_adjustment(self.terminal.get_adjustment())
+        hbox.pack_end(scrollbar)
+
+        self.show_all()
+
+def main():
+    dialog = TerminalDialog()
+    dialog.run()
+
+if __name__ == '__main__':
+    main()



More information about the Ocfs2-tools-commits mailing list