[Ocfs2-tools-commits] manish commits r544 - trunk/ocfs2tool
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Jan 7 20:14:04 CST 2005
Author: manish
Date: 2005-01-07 20:14:02 -0600 (Fri, 07 Jan 2005)
New Revision: 544
Added:
trunk/ocfs2tool/interface.py
Removed:
trunk/ocfs2tool/main.py
Modified:
trunk/ocfs2tool/Makefile
trunk/ocfs2tool/ocfs2tool
Log:
Renaming main ui source file, update makefile for new files
Modified: trunk/ocfs2tool/Makefile
===================================================================
--- trunk/ocfs2tool/Makefile 2005-01-08 02:10:01 UTC (rev 543)
+++ trunk/ocfs2tool/Makefile 2005-01-08 02:14:02 UTC (rev 544)
@@ -43,14 +43,26 @@
LIBRARIES = ocfs2module.so
-PYLIB = $(LIBRARIES) main.py guiutil.py process.py general.py nodemap.py \
- bitmap.py browser.py format.py
+PYSRC = \
+ about.py \
+ bitmap.py \
+ browser.py \
+ clconfig.py \
+ format.py \
+ general.py \
+ guiutil.py \
+ interface.py \
+ menu.py \
+ nodemap.py \
+ process.py
+PYLIB = $(LIBRARIES) $(PYSRC)
+
INSTALL_RULES = install-pylib
CLEAN_RULES = gen-clean
-DIST_FILES = $(CFILES) $(HFILES) ocfs2tool ocfsmarshal.list \
+DIST_FILES = $(CFILES) $(HFILES) $(PYSRC) ocfs2tool ocfsmarshal.list \
cellmap.defs cellmap.override ocfs2tool.8.in
ocfsmarshal.h: ocfsmarshal.list
Copied: trunk/ocfs2tool/interface.py (from rev 541, trunk/ocfs2tool/main.py)
Deleted: trunk/ocfs2tool/main.py
===================================================================
--- trunk/ocfs2tool/main.py 2005-01-08 02:10:01 UTC (rev 543)
+++ trunk/ocfs2tool/main.py 2005-01-08 02:14:02 UTC (rev 544)
@@ -1,297 +0,0 @@
-# OCFS2Tool - GUI frontend for OCFS2 management and debugging
-# Copyright (C) 2002, 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 sys
-
-import gtk
-
-import ocfs2
-
-from guiutil import set_props, error_box, query_text
-
-from menu import Menu
-from about import about
-from process import Process
-from format import format_partition
-from general import General
-from nodemap import NodeMap
-from browser import Browser
-from clconfig import cluster_configurator
-
-COLUMN_DEVICE = 0
-COLUMN_MOUNTPOINT = 1
-
-notebook_items = (
- ('general', 'General', General),
- ('browser', 'File Listing', Browser),
- ('nodemap', 'Configured Nodes', NodeMap),
-)
-
-def cleanup(*args):
- gtk.main_quit()
-
-class PartitionView(gtk.TreeView):
- def __init__(self, toplevel):
- store = gtk.ListStore(str, str, str)
-
- gtk.TreeView.__init__(self, store)
-
- self.toplevel = toplevel
- self.advanced = False
-
- self.insert_column_with_attributes(-1, 'Device',
- gtk.CellRendererText(),
- text=COLUMN_DEVICE)
- self.insert_column_with_attributes(-1, 'Mountpoint',
- gtk.CellRendererText(),
- text=COLUMN_MOUNTPOINT)
-
- sel = self.get_selection()
- sel.connect('changed', self.on_select)
-
- def get_sel_values(self):
- sel = self.get_selection()
- store, iter = sel.get_selected()
-
- if store and iter:
- return store[iter]
- else:
- return None
-
- def get_device(self):
- selection = self.get_sel_values()
-
- if selection:
- return selection[COLUMN_DEVICE]
- else:
- return None
-
- def on_select(self, sel):
- device, mountpoint = self.get_sel_values()
-
- if mountpoint:
- self.mount_button.set_sensitive(False)
- self.unmount_button.set_sensitive(True)
- else:
- self.mount_button.set_sensitive(True)
- self.unmount_button.set_sensitive(False)
-
- update_notebook(self, device)
-
- def select_device(self, device):
- for row in self.get_model():
- if row[COLUMN_DEVICE] == device:
- sel = self.get_selection()
- sel.select_iter(row.iter)
-
- def refresh_partitions(self):
- def list_compare(store, a, b):
- d1, m1 = store[a]
- d2, m2 = store[b]
-
- if m1 and not m2:
- return -1
- elif not m1 and m2:
- return 1
- else:
- return cmp(d1, d2)
-
- self.mount_button.set_sensitive(False)
- self.unmount_button.set_sensitive(False)
-
- old_device = self.get_device()
-
- store = gtk.ListStore(str, str)
- self.set_model(store)
-
- sel = self.get_selection()
- selected = False
-
- for partition in ocfs2.partition_list():
- iter = store.append(partition)
-
- if partition[0] == old_device:
- sel.select_iter(iter)
- selected = True
-
- store.set_sort_func(COLUMN_DEVICE, list_compare)
- store.set_sort_column_id(COLUMN_DEVICE, gtk.SORT_ASCENDING)
-
- if len(store) and not selected:
- sel.select_iter(store.get_iter_first())
-
-def mount(pv):
- device, mountpoint = pv.get_sel_values()
-
- mountpoint = query_text(pv.toplevel, 'Mountpoint')
- if not mountpoint:
- return
-
- command = ('mount', '-t', 'ocfs2', device, mountpoint)
-
- p = Process(command, 'Mount', 'Mounting...', pv.toplevel, spin_now=False)
- success, output, killed = p.reap()
-
- if not success:
- if killed:
- error_box(pv.toplevel,
- 'mount died unexpectedly! Your system is probably in '
- 'an inconsistent state. You should reboot at the '
- 'earliest opportunity')
- else:
- error_box(pv.toplevel, '%s: Could not mount %s' % (output, device))
-
- pv.refresh_partitions()
-
-def unmount(pv):
- device, mountpoint = pv.get_sel_values()
-
- command = ('umount', mountpoint)
-
- p = Process(command, 'Unmount', 'Unmounting...', pv.toplevel,
- spin_now=False)
- success, output, killed = p.reap()
-
- if success:
- pv.refresh_partitions()
- else:
- if killed:
- error_box(pv.toplevel,
- 'umount died unexpectedly! Your system is probably in '
- 'an inconsistent state. You should reboot at the '
- 'earliest opportunity')
- else:
- error_box(pv.toplevel,
- '%s: Could not unmount %s mounted on %s' %
- (output, device, mountpoint))
-
-def refresh(pv):
- pv.refresh_partitions()
-
- if len(pv.get_model()) == 0:
- update_notebook(pv, None)
-
-def update_notebook(pv, device):
- for tag, d, info in notebook_items:
- frame = getattr(pv, tag + '-frame')
- frame.child.destroy()
-
- frame.add(info(device, pv.advanced).widget)
- frame.show_all()
-
-def create_action_area(pv):
- vbbox = gtk.VButtonBox()
- set_props(vbbox, layout_style=gtk.BUTTONBOX_START,
- spacing=5,
- border_width=5)
-
- button = gtk.Button('Mount')
- vbbox.add(button)
- button.connect('clicked', mount, pv)
- pv.mount_button = button
-
- button = gtk.Button('Unmount')
- vbbox.add(button)
- button.connect('clicked', unmount, pv)
- pv.unmount_button = button
-
- button = gtk.Button('Refresh')
- vbbox.add(button)
- button.connect('clicked', refresh, pv)
-
- return vbbox
-
-def format(pv):
- format_partition(pv.toplevel, pv.get_device(), pv.advanced)
- pv.refresh_partitions()
-
-def check(pv):
- pass
-
-def repair(pv):
- pass
-
-def clconfig(pv):
- cluster_configurator(pv.toplevel, pv.advanced)
-
-def create_window():
- window = gtk.Window()
- set_props(window, title='OCFS2 Tool',
- default_width=520,
- default_height=420,
- border_width=0)
- window.connect('delete_event', cleanup)
-
- pv = PartitionView(window)
-
- vbox = gtk.VBox()
- window.add(vbox)
-
- menu = Menu(cleanup=cleanup, format=format, check=check, repair=repair,
- clconfig=clconfig, about=about)
-
- menubar = menu.get_widget(window, pv)
- vbox.pack_start(menubar, expand=False, fill=False)
-
- vpaned = gtk.VPaned()
- vpaned.set_border_width(4)
- vbox.pack_start(vpaned, expand=True, fill=True)
-
- hbox = gtk.HBox(spacing=4)
- vpaned.pack1(hbox)
-
- scrl_win = gtk.ScrolledWindow()
- set_props(scrl_win, hscrollbar_policy=gtk.POLICY_AUTOMATIC,
- vscrollbar_policy=gtk.POLICY_AUTOMATIC,
- parent=hbox)
-
- scrl_win.add(pv)
-
- frame = gtk.Frame()
- frame.set_shadow_type(gtk.SHADOW_IN)
- hbox.pack_end(frame, expand=False, fill=False)
-
- vbbox = create_action_area(pv)
- frame.add(vbbox)
-
- notebook = gtk.Notebook()
- notebook.set_tab_pos(gtk.POS_TOP)
- vpaned.pack2(notebook)
-
- for tag, desc, info in notebook_items:
- frame = gtk.Frame()
- set_props(frame, shadow=gtk.SHADOW_NONE,
- border_width=0)
-
- tag = tag + '-frame'
- setattr(pv, tag, frame)
-
- frame.add(info().widget)
- frame.show_all()
-
- notebook.add_with_properties(frame, 'tab_label', desc)
-
- pv.refresh_partitions()
-
- window.show_all()
-
-def main():
- create_window()
- gtk.main()
-
-if __name__ == '__main__':
- main()
Modified: trunk/ocfs2tool/ocfs2tool
===================================================================
--- trunk/ocfs2tool/ocfs2tool 2005-01-08 02:10:01 UTC (rev 543)
+++ trunk/ocfs2tool/ocfs2tool 2005-01-08 02:14:02 UTC (rev 544)
@@ -6,5 +6,5 @@
from about import process_info_args
process_info_args()
-from main import main
+from interface import main
main()
More information about the Ocfs2-tools-commits
mailing list