Ejemplo n.º 1
0
 def test_correct_arguments_no_cube(self):
     window = main_window.MainWindow(None)
     status = window.get_status()
     keys_given = status.keys()
     keys_expected = ('cube', 'plot method', 'plot type', 'projection',
                      'cmap', 'num contours', 'cartographic', 'gridlines',
                      'contour labels', 'colorbar range', 'dim indices',
                      'slice index', 'collapsed indices', 'can draw map')
     for key in keys_expected:
         if not key in keys_given:
             missing = key
             break
         missing = None
     self.assertIsNone(missing)
Ejemplo n.º 2
0
def main():
    """
    The main method sets up a new QApplication object, which takes care of the
    main event loop in Qt. It then chexks to see if the program has been called
    with a file as an argument, and then opens a new main window for the
    program.

    """
    app = QtGui.QApplication(sys.argv)
    try:
        _, filename = sys.argv
    except ValueError:
        filename = None
    _ = main_window.MainWindow(filename)
    sys.exit(app.exec_())
Ejemplo n.º 3
0
 def test_correct_dim_indices(self):
     window = main_window.MainWindow(None)
     cubes = iris.load(iris.sample_data_path('air_temp.pp'))
     window.cubes = cubes
     window.cube_loaded = True
     window.filename = 'some string'
     window.select_cube.addItem('cube')
     window.select_cube.setCurrentIndex(0)
     window.select_dimension_1.addItem('coord')
     window.select_dimension_1.setCurrentIndex(0)
     status = window.get_status()
     keys_given = status['dim indices'].keys()
     keys_expected = ('dim 1 index', 'dim 2 index', 'sliced dim index')
     for key in keys_expected:
         if not key in keys_given:
             missing = key
             break
         missing = None
     self.assertIsNone(missing)
Ejemplo n.º 4
0
 def test_correct_arguments_passed_update(self):
     window = main_window.MainWindow(None)
     cubes = iris.load(iris.sample_data_path('air_temp.pp'))
     window.cubes = cubes
     window.cube_loaded = True
     window.filename = 'some string'
     window.select_cube.addItem('cube')
     window.select_cube.setCurrentIndex(0)
     window.select_dimension_1.addItem('coord')
     window.select_dimension_1.setCurrentIndex(0)
     status = window.get_status()
     keys_given = status.keys()
     keys_expected = ('cube', 'plot method', 'plot type', 'projection',
                      'cmap', 'num contours', 'cartographic', 'gridlines',
                      'contour labels', 'colorbar range', 'dim indices',
                      'slice index', 'collapsed indices', 'can draw map')
     for key in keys_expected:
         if not key in keys_given:
             missing = key
             break
         missing = None
     self.assertIsNone(missing)