Move gtk-based items out of scope of import for cli

svn: r13599
This commit is contained in:
Doug Blank
2009-11-16 22:39:54 +00:00
parent 06017f562e
commit f272ce3dd1
4 changed files with 12 additions and 7 deletions

View File

@@ -37,7 +37,6 @@ from gettext import gettext as _
# GNOME/GTK
#
#-------------------------------------------------------------------------
import gtk
#-------------------------------------------------------------------------
#
@@ -46,7 +45,6 @@ import gtk
#-------------------------------------------------------------------------
import gen.lib
import Errors
from QuestionDialog import WarningDialog, ErrorDialog
#-------------------------------------------------------------------------
#
@@ -58,6 +56,7 @@ def add_menuitem(menu, msg, obj, func):
add a menuitem to menu with label msg, which activates func, and has data
obj
"""
import gtk
item = gtk.MenuItem(msg)
item.set_data('o', obj)
item.connect("activate", func)
@@ -93,6 +92,7 @@ class ProgressMeter(object):
"""
Specify the title and the current pass header.
"""
import gtk
self.__mode = ProgressMeter.MODE_FRACTION
self.__pbar_max = 100.0
self.__pbar_index = 0.0
@@ -127,6 +127,7 @@ class ProgressMeter(object):
Reset for another pass. Provide a new header and define number
of steps to be used.
"""
import gtk
self.__mode = mode
self.__pbar_max = total
self.__pbar_index = 0.0
@@ -148,7 +149,7 @@ class ProgressMeter(object):
def step(self):
"""Click the progress bar over to the next value. Be paranoid
and insure that it doesn't go over 100%."""
import gtk
if self.__mode is ProgressMeter.MODE_FRACTION:
self.__pbar_index = self.__pbar_index + 1.0
@@ -179,6 +180,7 @@ class ProgressMeter(object):
"""
Don't let the user close the progress dialog.
"""
from QuestionDialog import WarningDialog
WarningDialog(
_("Attempt to force closing the dialog"),
_("Please do not force closing this important dialog."),
@@ -207,6 +209,7 @@ def open_file_with_default_application( file_path ):
@type file_path: string
@return: nothing
"""
from QuestionDialog import ErrorDialog
norm_path = os.path.normpath( file_path )
if not os.path.exists(norm_path):