22import numpy
33import sys
44from qtpandas .excepthook import excepthook
5- sys .excepthook = excepthook
65
7- # use QtGui from the compat module to take care if correct sip version, etc.
6+ # Use QtGui from the compat module to take care if correct sip version, etc.
87from qtpandas .compat import QtGui
98from qtpandas .models .DataFrameModel import DataFrameModel
109from qtpandas .views .DataTableView import DataTableWidget
1110from qtpandas .views ._ui import icons_rc
1211
13- """setup a new empty model"""
12+ sys .excepthook = excepthook
13+
14+ # Setup a new empty model
1415model = DataFrameModel ()
1516
16- """setup an application and create a table view widget"""
17+ # Setup an application and create a table view widget
1718app = QtGui .QApplication ([])
1819widget = DataTableWidget ()
1920widget .resize (800 , 600 )
2021widget .show ()
21- """asign the created model"""
22+ # Asign the created model"""
2223widget .setViewModel (model )
2324
24- """create some test data"""
25+ # Create some test data
2526data = {
26- 'A' : [10 , 11 , 12 ],
27- 'B' : [20 , 21 , 22 ],
27+ 'A' : [10 , 11 , 12 ],
28+ 'B' : [20 , 21 , 22 ],
2829 'C' : ['Peter Pan' , 'Cpt. Hook' , 'Tinkerbell' ]
2930}
3031df = pandas .DataFrame (data )
31- """convert the column to the numpy.int8 datatype to test the delegates in the table
32- int8 is limited to -128-127
33- """
32+ # Convert the column to the numpy.int8 datatype to test the delegates in the
33+ # table int8 is limited to -128-127
34+
3435df ['A' ] = df ['A' ].astype (numpy .int8 )
3536df ['B' ] = df ['B' ].astype (numpy .float16 )
3637
37- """fill the model with data"""
38+ # Fill the model with data
3839model .setDataFrame (df )
3940
40- """ start the app"""
41- app .exec_ ()
41+ # start the app
42+ app .exec_ ()
0 commit comments