Esempio n. 1
0
def startup(**kwds):
    global view

    Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    if not Globals.chandlerDirectory:
        print "Please set CHANDLERHOME"
        return None
    os.chdir(Globals.chandlerDirectory)

    Utility.initLocale('en')

    Globals.options = Utility.initOptions(Globals.chandlerDirectory, **kwds)
    profileDir = Globals.options.profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.chandlerDirectory,
                                       Globals.options.parcelPath)

    view = Utility.initRepository(Utility.locateRepositoryDirectory(profileDir),
                                  Globals.options)

    if not Utility.verifySchema(view):
        print "Schema mismatch.  Try again with startup(create=True)"
        return None

    Utility.initCrypto(Globals.options.profileDir)
    Utility.initParcels(view, parcelPath)

    if Globals.options.createData:
        import GenerateItemsFromFile
        GenerateItemsFromFile.RunScript(view)

    return view
Esempio n. 2
0
def startup(**kwds):
    global view

    Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    if not Globals.chandlerDirectory:
        print "Please set CHANDLERHOME"
        return None
    os.chdir(Globals.chandlerDirectory)

    Utility.initLocale('en')

    Globals.options = Utility.initOptions(Globals.chandlerDirectory, **kwds)
    profileDir = Globals.options.profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.chandlerDirectory,
                                       Globals.options.parcelPath)

    view = Utility.initRepository(
        Utility.locateRepositoryDirectory(profileDir), Globals.options)

    if not Utility.verifySchema(view):
        print "Schema mismatch.  Try again with startup(create=True)"
        return None

    Utility.initCrypto(Globals.options.profileDir)
    Utility.initParcels(view, parcelPath)

    if Globals.options.createData:
        import GenerateItemsFromFile
        GenerateItemsFromFile.RunScript(view)

    return view
Esempio n. 3
0
 def setUp(self):
     Globals.options = Utility.initOptions()
     Globals.options.ramdb = True
     Utility.initLogging(Globals.options)
     self.views = []
     for i in xrange(2):
         view = Utility.initRepository("", Globals.options, True)
         view.name = "test_view_%d" % i
         self.views.append(view)
         Utility.initTimezone(Globals.options, view)
 def setUp(self):
     Globals.options = Utility.initOptions()
     Globals.options.ramdb = True
     Utility.initLogging(Globals.options)
     self.views = []
     for i in xrange(2):
         view = Utility.initRepository("", Globals.options, True)
         view.name = "test_view_%d" % i
         self.views.append(view)
         Utility.initTimezone(Globals.options, view)
Esempio n. 5
0
def startup(chandlerDirectory=None, **kwds):
    global view, commitOnExit

    Globals.options = Utility.initOptions(**kwds)
    if chandlerDirectory is None:
        Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    else:
        Globals.chandlerDirectory = chandlerDirectory

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = Globals.options.profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.options,
                                       Globals.chandlerDirectory)
    pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options,
                                                  Globals.options.pluginPath)

    Globals.options.getPassword = getPassword
    repoDir = Utility.locateRepositoryDirectory(profileDir, Globals.options)
    view = Utility.initRepository(repoDir, Globals.options)

    verify, repoVersion, schemaVersion = Utility.verifySchema(view)
    if not verify:
        print "Schema mismatch (%s vs %s).  Try again with startup(create=True)" % (
            repoVersion, schemaVersion)
        return None

    Utility.initCrypto(Globals.options.profileDir)
    Utility.initParcels(Globals.options, view, parcelPath)
    Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs)
    Utility.initTimezone(Globals.options, view)

    if Globals.options.reload:
        from osaf import dumpreload
        dumpreload.reload(view, Globals.options.reload)

    return view
Esempio n. 6
0
def startup(chandlerDirectory=None, **kwds):
    global view, commitOnExit

    Globals.options = Utility.initOptions(**kwds)
    if chandlerDirectory is None:
        Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    else:
        Globals.chandlerDirectory = chandlerDirectory

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = Globals.options.profileDir

    Utility.initLogging(Globals.options)

    parcelPath = Utility.initParcelEnv(Globals.options, 
                                       Globals.chandlerDirectory)
    pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options,
                                                  Globals.options.pluginPath)

    Globals.options.getPassword = getPassword
    repoDir = Utility.locateRepositoryDirectory(profileDir, Globals.options)
    view = Utility.initRepository(repoDir, Globals.options)

    verify, repoVersion, schemaVersion = Utility.verifySchema(view)
    if not verify:
        print "Schema mismatch (%s vs %s).  Try again with startup(create=True)" %(repoVersion, schemaVersion)
        return None

    Utility.initCrypto(Globals.options.profileDir)
    Utility.initParcels(Globals.options, view, parcelPath)
    Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs)
    Utility.initTimezone(Globals.options, view)

    if Globals.options.reload:
        from osaf import dumpreload
        dumpreload.reload(view, Globals.options.reload)

    return view
    e_options, names = epydoc.cli.parse_arguments()

    e_options.prj_name = 'Chandler'
    e_options.exclude = ['tests', 'wx']
    e_options.simple_term = True
    e_options.parse = True
    e_options.introspect = True
    e_options.include_log = True
    e_options.target = os.path.join(outputDir, 'api')
    e_options.verbosity = 4

    epydoc.cli.main(e_options, names)


if __name__ == '__main__':
    Globals.options = Utility.initOptions()
    Globals.options.create = True
    Globals.options.verify = False

    Globals.chandlerDirectory = Utility.locateChandlerDirectory()

    os.chdir(Globals.chandlerDirectory)
    Utility.initI18n(Globals.options)

    profileDir = os.path.abspath(
        os.path.join(Globals.chandlerDirectory, '..', 'doc_profile'))

    if not os.path.isdir(profileDir):
        _mkdirs(profileDir)

    print Globals.chandlerDirectory
Esempio n. 8
0
 def setUp(self):
     Globals.options = Utility.initOptions()
     Globals.options.ramdb = True
     Utility.initLogging(Globals.options)
     self.view = Utility.initRepository("", Globals.options, True)
     Utility.initTimezone(Globals.options, self.view)
Esempio n. 9
0
 def setUp(self):
     Globals.options = Utility.initOptions()
     Utility.initLogging(Globals.options)
     self.view = NullRepositoryView()
     Utility.initTimezone(Globals.options, self.view)
Esempio n. 10
0
def main():
    message = "while trying to start."

    application.Globals.chandlerDirectory = Utility.locateChandlerDirectory()

    os.chdir(application.Globals.chandlerDirectory)
    """
    Process any command line switches and any environment variable values
    """
    application.Globals.options = Utility.initOptions(
        application.Globals.chandlerDirectory)
    Utility.initLogging(application.Globals.options)

    def realMain():
        if __debug__ and application.Globals.options.wing:
            """
              Check for -wing command line argument; if specified, try to connect to
            an already-running WingIDE instance.  See:
              http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#wingIDE.
            for details.
            """
            import wingdbstub
        if __debug__ and application.Globals.options.komodo:
            """
            Check for -komodo command line argument; if specified, try to connect to
            an already-running Komodo instance.  See:
              http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#Komodo.
            for details.
            """
            import dbgp.client
            dbgp.client.brk()
        from application.Application import wxApplication
        """
          redirect stdio and stderr to a dialog if we're running the debug version.
        This is done to catch asserts, which otherwise will never get seen by
        people who run Chandler using the launchers, e.g. Aparna. If you're
        running release you can also set things up so that you can see
        stderr and stdout if you run in a shell or from wing with a console.
          useBestVisual, uses best screen resolutions on some old computers. See
        wxApp.SetUseBestVisual
        """
        #app = wxApplication(redirect=__debug__, useBestVisual=True)
        app = wxApplication(redirect=False, useBestVisual=True)
        app.MainLoop()

    if application.Globals.options.nocatch:
        # When debugging, it's handy to run without the outer exception frame
        import logging, traceback, wx
        realMain()
    else:
        # The normal way: wrap the app in an exception frame

        try:
            import logging, traceback, wx
            realMain()

        except (RepositoryOpenDeniedError, ExclusiveOpenDeniedError):
            message = "Another instance of Chandler currently has the " \
                      "repository open."
            logging.exception(message)
            dialog = wx.MessageDialog(None, message, "Chandler",
                                      wx.OK | wx.ICON_INFORMATION)
            dialog.ShowModal()
            dialog.Destroy()

        except Utility.SchemaMismatchError:
            logging.info("User chose not to clear the repository.  Exiting.")

        except Exception:
            type, value, stack = sys.exc_info()
            formattedBacktrace = "".join(
                traceback.format_exception(type, value, stack, 5))

            message = ("Chandler encountered an unexpected problem %s\n" + \
                      "Here are the bottom 5 frames of the stack:\n%s") % (message, formattedBacktrace)
            logging.exception(message)
            # @@@ 25Issue - Cannot create wxItems if the app failed to initialize
            dialog = wx.MessageDialog(None, message, "Chandler",
                                      wx.OK | wx.ICON_INFORMATION)
            dialog.ShowModal()
            dialog.Destroy()

            #Reraising the exception, so wing catches it.
            raise
Esempio n. 11
0
cause *all* modules in all sub-packages of that package to be imported.)

"""

import sys

from unittest import main
from application import Globals, Utility
from util import test_finder

if __name__ == '__main__':

    if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'):  # XXX
        print __doc__
        sys.exit(2)

    options = Utility.initOptions()
    Utility.initI18n(options)
    Utility.initLogging(options)

    # Rebuild the command line for unittest.main
    args = [sys.argv[0]]
    if options.verbose:
        args.append('-v')
    if options.quiet:
        args.append('-q')
    # options.args has all the leftover arguments from Utility
    sys.argv = args + options.args

    main(module=None, testLoader=test_finder.ScanningLoader())
Esempio n. 12
0
 def setUp(self):
     Globals.options = Utility.initOptions()
     Utility.initLogging(Globals.options)
     self.view = NullRepositoryView()
     Utility.initTimezone(Globals.options, self.view)
Esempio n. 13
0
def main():

    # Process any command line switches and any environment variable values
    Globals.options = Utility.initOptions()

    def realMain():
        
        from application import feedback
        feedback.initRuntimeLog(Globals.options.profileDir)
        
        Globals.chandlerDirectory = Utility.locateChandlerDirectory()
    
        os.chdir(Globals.chandlerDirectory)
        Utility.initLogging(Globals.options)

        if __debug__ and Globals.options.wing:
            # Check for -wing command line argument; if specified, try to 
            # connect to an already-running WingIDE instance. See
            # http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#wingIDE
            # for details.

            import wingdbstub

        if __debug__ and Globals.options.komodo:
            # Check for -komodo command line argument; if specified, try to 
            # connect to an already-running Komodo instance. See
            # http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#Komodo
            # for details.

            import dbgp.client
            dbgp.client.brk()

        from application.Application import wxApplication

        # Redirect stdio and stderr to a dialog if a non-default --catch option 
        # was specified. This is done to catch asserts, which otherwise will
        # never get seen by people who run Chandler using the launchers, e.g.
        # Aparna. If you're running release you can also set things up so 
        # that you can see stderr and stdout if you run in a shell or from
        # wing with a console.
        redirect = Globals.options.catch == 'normal'
        
        # useBestVisual: See wxApp.SetUseBestVisual (Only applicable
        # for X-Windows based systems) On some older computers the
        # default visual may only have a depth of 8 although 24-bit
        # visuals are available. (SGI is notorious for this.) Setting
        # this to True will cause the best visual to be used instead.
        # Unfortunatly on some systems with a 32-bit visual available
        # this can cause problems if the default GTK theme expects to
        # use only 24.  (See Bug #9295) So for now we'll default this
        # to False.  If this becomes a problem in the future then we
        # should add a command-line option for it or perhaps find a
        # way to detect if the display depth is < 24.  (Note there is
        # a chicken-and-egg problem with wx.GetDisplayDepth() as it
        # needs to have the app created before it can be called.)
        useBestVisual = False
        
        app = wxApplication(redirect=redirect, useBestVisual=useBestVisual)

        exitValue = getattr(app, 'exitValue', 0)
        if exitValue:
            return exitValue

        app.MainLoop()

        return getattr(app, 'exitValue', 0)

    if Globals.options.catch != 'normal':
        # When debugging, it's handy to run without the outer exception frame
        return realMain()
    else:
        try:
            # The normal way: wrap the app in an exception frame
            from chandlerdb.persistence.RepositoryError \
                import RepositoryOpenDeniedError, ExclusiveOpenDeniedError

            import logging, wx
            from i18n import ChandlerSafeTranslationMessageFactory as _
            return realMain()

        except (RepositoryOpenDeniedError, ExclusiveOpenDeniedError):
            # This doesn't seem worth the effor to localize, since we don't have a repository
            # which is necessary for localization.
            try:
                logging.error("Another instance of Chandler currently has the repository open.")
                dialog = wx.MessageDialog(None,
                                          _(u"Another Chandler is already running off the same data repository."),
                                          u"Chandler", wx.OK | wx.ICON_INFORMATION)
                dialog.ShowModal()
                dialog.Destroy()
            finally:
                return 1

        except Utility.SchemaMismatchError:
            try:
                logging.info("User chose not to clear the repository.  Exiting.")
            finally:
                return 1

        except:
            try:
                import traceback
                
                line1 = "Chandler encountered an unexpected problem while trying to start.\n"
                
                type, value, stack = sys.exc_info()
                backtrace = traceback.format_exception(type, value, stack)
                
                longMessage = "".join([line1, "\n"] + backtrace)
                
                logging.error(longMessage)
                
                if getattr(globals(), 'app', None) is None or wx.GetApp() is None:
                    app = wx.PySimpleApp()
                    app.ignoreSynchronizeWidget = True
                
                try:
                    # Let's try the best (and most complicated) option
                    # first
                    # See if we already have a window up, and if so, reuse it
                    from application import feedback
                    feedback.destroyAppOnClose = True
                    win = feedback.FeedbackWindow()
                    win.CreateOutputWindow('')
                    for line in backtrace:
                        win.write(line)
                    if not app.IsMainLoopRunning():
                        app.MainLoop()
                except:
                    # Fall back to our custom (but simple) error dialog
                    try:
                        from application.dialogs.UncaughtExceptionDialog import ErrorDialog
                        dialog = ErrorDialog(longMessage)
                    except:
                        # Fall back to MessageDialog
                        frames = 8
                        line = _(u"Start up error.\nHere are the bottom %(numOf)s frames of the stack: %(stacktrace)s\n\n") % {'numOf': frames - 1, "stacktrace": unicode("".join(backtrace[-frames:]), "UTF-8", "ignore")}
                        dialog = wx.MessageDialog(None, line, u"Chandler", wx.OK | wx.ICON_INFORMATION)
                    dialog.ShowModal()
                    dialog.Destroy()
            finally:
                return 1
Esempio n. 14
0
"""

import sys

from unittest import main
from application import Globals, Utility
from util import test_finder


if __name__ == '__main__':

    if len(sys.argv)<2 or sys.argv[1] in ('-h','--help'):   # XXX
        print __doc__
        sys.exit(2)

    options = Utility.initOptions()
    Utility.initI18n(options)
    Utility.initLogging(options)

    # Rebuild the command line for unittest.main
    args = [sys.argv[0]]
    if options.verbose:
        args.append('-v')
    if options.quiet:
        args.append('-q')
    # options.args has all the leftover arguments from Utility
    sys.argv = args + options.args

    main(module=None, testLoader=test_finder.ScanningLoader())

Esempio n. 15
0
def main():
    message = "while trying to start."

    application.Globals.chandlerDirectory = Utility.locateChandlerDirectory()

    os.chdir(application.Globals.chandlerDirectory)

    """
    Process any command line switches and any environment variable values
    """
    application.Globals.options = Utility.initOptions(application.Globals.chandlerDirectory)
    Utility.initLogging(application.Globals.options)

    def realMain():
        if __debug__ and application.Globals.options.wing:
            """
              Check for -wing command line argument; if specified, try to connect to
            an already-running WingIDE instance.  See:
              http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#wingIDE.
            for details.
            """
            import wingdbstub
        if __debug__ and application.Globals.options.komodo:
            """
            Check for -komodo command line argument; if specified, try to connect to
            an already-running Komodo instance.  See:
              http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#Komodo.
            for details.
            """
            import dbgp.client

            dbgp.client.brk()
        from application.Application import wxApplication

        """
          redirect stdio and stderr to a dialog if we're running the debug version.
        This is done to catch asserts, which otherwise will never get seen by
        people who run Chandler using the launchers, e.g. Aparna. If you're
        running release you can also set things up so that you can see
        stderr and stdout if you run in a shell or from wing with a console.
          useBestVisual, uses best screen resolutions on some old computers. See
        wxApp.SetUseBestVisual
        """
        # app = wxApplication(redirect=__debug__, useBestVisual=True)
        app = wxApplication(redirect=False, useBestVisual=True)
        app.MainLoop()

    if application.Globals.options.nocatch:
        # When debugging, it's handy to run without the outer exception frame
        import logging, traceback, wx

        realMain()
    else:
        # The normal way: wrap the app in an exception frame

        try:
            import logging, traceback, wx

            realMain()

        except (RepositoryOpenDeniedError, ExclusiveOpenDeniedError):
            message = "Another instance of Chandler currently has the " "repository open."
            logging.exception(message)
            dialog = wx.MessageDialog(None, message, "Chandler", wx.OK | wx.ICON_INFORMATION)
            dialog.ShowModal()
            dialog.Destroy()

        except Utility.SchemaMismatchError:
            logging.info("User chose not to clear the repository.  Exiting.")

        except Exception:
            type, value, stack = sys.exc_info()
            formattedBacktrace = "".join(traceback.format_exception(type, value, stack, 5))

            message = (
                "Chandler encountered an unexpected problem %s\n" + "Here are the bottom 5 frames of the stack:\n%s"
            ) % (message, formattedBacktrace)
            logging.exception(message)
            # @@@ 25Issue - Cannot create wxItems if the app failed to initialize
            dialog = wx.MessageDialog(None, message, "Chandler", wx.OK | wx.ICON_INFORMATION)
            dialog.ShowModal()
            dialog.Destroy()

            # Reraising the exception, so wing catches it.
            raise
Esempio n. 16
0
 def setUp(self):
     Globals.options = Utility.initOptions()
     Globals.options.ramdb = True
     Utility.initLogging(Globals.options)
     self.view = Utility.initRepository("", Globals.options, True)
     Utility.initTimezone(Globals.options, self.view)
Esempio n. 17
0
def main():

    # Process any command line switches and any environment variable values
    Globals.options = Utility.initOptions()

    def realMain():

        from application import feedback
        feedback.initRuntimeLog(Globals.options.profileDir)

        Globals.chandlerDirectory = Utility.locateChandlerDirectory()

        os.chdir(Globals.chandlerDirectory)
        Utility.initLogging(Globals.options)

        if __debug__ and Globals.options.wing:
            # Check for -wing command line argument; if specified, try to
            # connect to an already-running WingIDE instance. See
            # http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#wingIDE
            # for details.

            import wingdbstub

        if __debug__ and Globals.options.komodo:
            # Check for -komodo command line argument; if specified, try to
            # connect to an already-running Komodo instance. See
            # http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#Komodo
            # for details.

            import dbgp.client
            dbgp.client.brk()

        from application.Application import wxApplication

        # Redirect stdio and stderr to a dialog if a non-default --catch option
        # was specified. This is done to catch asserts, which otherwise will
        # never get seen by people who run Chandler using the launchers, e.g.
        # Aparna. If you're running release you can also set things up so
        # that you can see stderr and stdout if you run in a shell or from
        # wing with a console.
        redirect = Globals.options.catch == 'normal'

        # useBestVisual: See wxApp.SetUseBestVisual (Only applicable
        # for X-Windows based systems) On some older computers the
        # default visual may only have a depth of 8 although 24-bit
        # visuals are available. (SGI is notorious for this.) Setting
        # this to True will cause the best visual to be used instead.
        # Unfortunatly on some systems with a 32-bit visual available
        # this can cause problems if the default GTK theme expects to
        # use only 24.  (See Bug #9295) So for now we'll default this
        # to False.  If this becomes a problem in the future then we
        # should add a command-line option for it or perhaps find a
        # way to detect if the display depth is < 24.  (Note there is
        # a chicken-and-egg problem with wx.GetDisplayDepth() as it
        # needs to have the app created before it can be called.)
        useBestVisual = False

        app = wxApplication(redirect=redirect, useBestVisual=useBestVisual)

        exitValue = getattr(app, 'exitValue', 0)
        if exitValue:
            return exitValue

        app.MainLoop()

        return getattr(app, 'exitValue', 0)

    if Globals.options.catch != 'normal':
        # When debugging, it's handy to run without the outer exception frame
        return realMain()
    else:
        try:
            # The normal way: wrap the app in an exception frame
            from chandlerdb.persistence.RepositoryError \
                import RepositoryOpenDeniedError, ExclusiveOpenDeniedError

            import logging, wx
            from i18n import ChandlerSafeTranslationMessageFactory as _
            return realMain()

        except (RepositoryOpenDeniedError, ExclusiveOpenDeniedError):
            # This doesn't seem worth the effor to localize, since we don't have a repository
            # which is necessary for localization.
            try:
                logging.error(
                    "Another instance of Chandler currently has the repository open."
                )
                dialog = wx.MessageDialog(
                    None,
                    _(u"Another Chandler is already running off the same data repository."
                      ), u"Chandler", wx.OK | wx.ICON_INFORMATION)
                dialog.ShowModal()
                dialog.Destroy()
            finally:
                return 1

        except Utility.SchemaMismatchError:
            try:
                logging.info(
                    "User chose not to clear the repository.  Exiting.")
            finally:
                return 1

        except:
            try:
                import traceback

                line1 = "Chandler encountered an unexpected problem while trying to start.\n"

                type, value, stack = sys.exc_info()
                backtrace = traceback.format_exception(type, value, stack)

                longMessage = "".join([line1, "\n"] + backtrace)

                logging.error(longMessage)

                if getattr(globals(), 'app',
                           None) is None or wx.GetApp() is None:
                    app = wx.PySimpleApp()
                    app.ignoreSynchronizeWidget = True

                try:
                    # Let's try the best (and most complicated) option
                    # first
                    # See if we already have a window up, and if so, reuse it
                    from application import feedback
                    feedback.destroyAppOnClose = True
                    win = feedback.FeedbackWindow()
                    win.CreateOutputWindow('')
                    for line in backtrace:
                        win.write(line)
                    if not app.IsMainLoopRunning():
                        app.MainLoop()
                except:
                    # Fall back to our custom (but simple) error dialog
                    try:
                        from application.dialogs.UncaughtExceptionDialog import ErrorDialog
                        dialog = ErrorDialog(longMessage)
                    except:
                        # Fall back to MessageDialog
                        frames = 8
                        line = _(
                            u"Start up error.\nHere are the bottom %(numOf)s frames of the stack: %(stacktrace)s\n\n"
                        ) % {
                            'numOf':
                            frames - 1,
                            "stacktrace":
                            unicode("".join(backtrace[-frames:]), "UTF-8",
                                    "ignore")
                        }
                        dialog = wx.MessageDialog(None, line, u"Chandler",
                                                  wx.OK | wx.ICON_INFORMATION)
                    dialog.ShowModal()
                    dialog.Destroy()
            finally:
                return 1
Esempio n. 18
0
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import sys
import unittest
import itertools
from application import schema, Globals, Utility
from chandlerdb.persistence.RepositoryView import NullRepositoryView

Globals.chandlerDirectory = Utility.locateChandlerDirectory()
Globals.options = Utility.initOptions()


class MenuTestCase(unittest.TestCase):
    """
    Tests of consistent mnemonics/shortcuts in Chandler's menus.
    """

    view = None

    def setUp(self):
        # This setup is needed because we'd like to be able to use
        # --locale on the command line to test a given locale. So,
        # basically the code below is copy-and-pasted out of Utility.py
        # to make sure that everything gets initialized in the right
        # order.