Move gtk-based items out of scope of import for cli
svn: r13599
This commit is contained in:
		@@ -37,8 +37,6 @@ import tempfile
 | 
			
		||||
# GTK/Gnome modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
import gtk
 | 
			
		||||
import gobject
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
@@ -59,6 +57,7 @@ def resize_to_jpeg(source, destination, width, height):
 | 
			
		||||
    :param height: desired height of the destination image
 | 
			
		||||
    :type height: int
 | 
			
		||||
    """
 | 
			
		||||
    import gtk
 | 
			
		||||
    img = gtk.gdk.pixbuf_new_from_file(source)
 | 
			
		||||
    scaled = img.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
 | 
			
		||||
    scaled.save(destination, 'jpeg')
 | 
			
		||||
@@ -77,6 +76,8 @@ def image_size(source):
 | 
			
		||||
    :rtype: tuple(int, int)
 | 
			
		||||
    :returns: a tuple consisting of the width and height
 | 
			
		||||
    """
 | 
			
		||||
    import gtk
 | 
			
		||||
    import gobject
 | 
			
		||||
    try:
 | 
			
		||||
        img = gtk.gdk.pixbuf_new_from_file(source)
 | 
			
		||||
        width = img.get_width()
 | 
			
		||||
@@ -105,6 +106,7 @@ def resize_to_jpeg_buffer(source, width, height):
 | 
			
		||||
    :rtype: buffer of data 
 | 
			
		||||
    :returns: jpeg image as raw data
 | 
			
		||||
    """
 | 
			
		||||
    import gtk
 | 
			
		||||
    filed, dest = tempfile.mkstemp()
 | 
			
		||||
    img = gtk.gdk.pixbuf_new_from_file(source)
 | 
			
		||||
    scaled = img.scale_simple(int(width), int(height), gtk.gdk.INTERP_BILINEAR)
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,6 @@ from gen.db.dbconst import *
 | 
			
		||||
from gen.utils.callback import Callback
 | 
			
		||||
from BasicUtils import UpdateCallback
 | 
			
		||||
import Errors
 | 
			
		||||
from QuestionDialog import QuestionDialog2
 | 
			
		||||
 | 
			
		||||
_LOG = logging.getLogger(DBLOGNAME)
 | 
			
		||||
_MINVERSION = 9
 | 
			
		||||
@@ -472,6 +471,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
 | 
			
		||||
        # self.secondary_connected flag should be set accordingly.
 | 
			
		||||
        
 | 
			
		||||
        if self.need_upgrade():
 | 
			
		||||
            from QuestionDialog import QuestionDialog2
 | 
			
		||||
            if QuestionDialog2(_("Need to upgrade database!"), 
 | 
			
		||||
                               _("You cannot open this database "
 | 
			
		||||
                                 "without upgrading it.\n"
 | 
			
		||||
 
 | 
			
		||||
@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,6 @@ import const
 | 
			
		||||
from gen.plug.docgen import BaseDoc, TextDoc, FONT_SANS_SERIF
 | 
			
		||||
from libhtmlbackend import HtmlBackend
 | 
			
		||||
from libhtml import Html
 | 
			
		||||
from QuestionDialog import WarningDialog
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
@@ -261,6 +260,7 @@ class HtmlDoc(BaseDoc, TextDoc):
 | 
			
		||||
        if from_fname != dest:
 | 
			
		||||
            shutil.copyfile(from_fname, dest)
 | 
			
		||||
        elif self.warn_dir:
 | 
			
		||||
            from QuestionDialog import WarningDialog
 | 
			
		||||
            WarningDialog(
 | 
			
		||||
                _("Possible destination error") + "\n" +
 | 
			
		||||
                _("You appear to have set your target directory "
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user