Example #1
0
    def __init__(self, parent):
        gridlib.Grid.__init__(self, parent, -1)
        self.attrtable = CustomDataTable()
        self.shapeeditor = None

        # The second parameter means that the grid is to take ownership of the
        # table and will destroy it when done.  Otherwise you would need to keep
        # a reference to it and call it's Destroy method later.
        self.SetTable(self.attrtable, True)

        self.SetRowLabelSize(0)
        self.SetMargins(0, 0)
        self.AutoSizeColumns(False)

        global g_maxattrrows
        for idx in range(g_maxattrrows):
            self.SetReadOnly(idx, 0, True)
            self.SetCellTextColour(idx, 0, wx.Colour(0, 0, 0))
            self.SetCellBackgroundColour(idx, 0, wx.Colour(230, 230, 230))
            self.SetReadOnly(idx, 1, True)

        gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
        self.Bind(gridlib.EVT_GRID_CELL_CHANGE, self.OnCellChange)
        self.Bind(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftCellClick)
        self.Bind(wx.EVT_SIZE, self.OnSize)
Example #2
0
    def __init__(self, parent):
        grid.Grid.__init__(self, parent, -1)

        table = TrackPointDataTable()
        self.table = table
        self.SetTable(table, True)

        self.SetRowLabelSize(0)
        self.SetColSize(0, 40)
        self.SetColSize(1, 140)
        self.SetColSize(2, 140)
        self.SetColSize(3, 100)
        self.SetColSize(4, 200)
        self.SetMargins(0, 0)
        self.EnableDragGridSize(0)
        self.SetLabelFont(self.GetCellFont(0, 0))
        self.SetColLabelSize(22)

        grid.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
        grid.EVT_GRID_CELL_RIGHT_DCLICK(self, self.OnRightDClick)
        wx.EVT_KEY_DOWN(self, self.OnKeypress)

        # Make some columns read-only
        attr = grid.GridCellAttr()
        attr.SetReadOnly()
        self.SetColAttr(0, attr)
        self.SetColAttr(1, attr)
        self.SetColAttr(2, attr)
        self.SetColAttr(3, attr)
        self.SetColAttr(4, attr)
Example #3
0
 def __init__(self, parent):
     gridlib.Grid.__init__(self, parent, -1)
     table = CustomDataTable()
     self.table = table
     self.SetTable(table, True)
     self.SetRowLabelSize(0)
     self.SetMargins(0, 0)
     self.AutoSizeColumns(False)  # Maybe set this to true
     gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
Example #4
0
 def __init__(self, parent, log):
     gridlib.Grid.__init__(self, parent, -1)
     table = CustomDataTable(log)
     self.shifttabledata=table
     # The second parameter means that the grid is to take ownership of the
     # table and will destroy it when done.  Otherwise you would need to keep
     # a reference to it and call its Destroy method later.
     self.SetTable(table, True)
     self.SetRowLabelSize(35)
     self.SetMargins(0,0)
     self.AutoSizeColumns(False)
     gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
Example #5
0
    def __init__(self, parent, table):
        gridlib.Grid.__init__(self, parent, -1)

        self.table = table

        # The second parameter means that the grid is to take ownership of the
        # table and will destroy it when done.  Otherwise you would need to keep
        # a reference to it and call it's Destroy method later.
        self.SetTable(self.table, True)

        self.SetRowLabelSize(0)
        self.SetMargins(0, 0)
        self.AutoSizeColumns(True)
        self.AutoSizeRows(True)
        self.SetColLabelSize(-1)  #gridlib.GRID_AUTOSIZE)

        gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
Example #6
0
 def __init__(self, parent, class_list):
     gridlib.Grid.__init__(
         self, 
         parent, 
         -1, 
         style = wx.BORDER_SUNKEN
         )
     self.data = self.create_data(class_list)
     self.table = CustomDataTable(self, self.data)        
     self.SetTable(self.table, False)
     self.SetSelectionMode(self.wxGridSelectRows)
     self.DisableDragRowSize()
     self.SetRowLabelSize(0)
     self.SetMargins(0, 0)
     self.AutoSizeColumns(False)
     self.update_col_attrs()        
     self.parent = parent
     gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.__on_left_dlcick)
     gridlib.EVT_GRID_SELECT_CELL(self, self.__on_select_cell)
     gridlib.EVT_GRID_RANGE_SELECT(self, self.__on_multiple_select)
Example #7
0
    def __init__(self,
                 parent,
                 libraryObj=None,
                 documentObj=None,
                 textPos=-1,
                 textSel=(-2, -2)):
        """Initialize a Document Quotes Tab object."""
        self.parent = parent
        # Initialize the ControlObject
        self.ControlObject = None
        # Make the initial data objects which are passed in available to the entire DocumentQuotesTab object
        self.libraryObj = libraryObj
        self.documentObj = documentObj
        self.textPos = textPos
        self.textSel = textSel

        # Get the size of the parent window
        psize = parent.GetSizeTuple()
        # Determine the size of the panel to be placed on the dialog, slightly smaller than the parent window
        width = psize[0] - 13
        height = psize[1] - 45

        # Create a Panel to put stuff on.  Use WANTS_CHARS style so the panel doesn't eat the Enter key.
        # (This panel implements the Document Quotes Tab!  All of the window and Notebook structure is provided by DataWindow.py.)
        wx.Panel.__init__(self,
                          parent,
                          -1,
                          style=wx.WANTS_CHARS,
                          size=(width, height),
                          name='DocumentQuotesTabPanel')

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Create a Grid Control on the panel where the quote data will be displayed
        self.gridQuotes = grid.Grid(self, -1)
        mainSizer.Add(self.gridQuotes, 1, wx.EXPAND)

        # Populate the Grid with initial values
        #   Grid is read-only, not editable
        self.gridQuotes.EnableEditing(False)
        #   Grid has 5 columns (two of which will not be visible), no rows initially
        self.gridQuotes.CreateGrid(1, 5)
        # Set the height of the Column Headings
        self.gridQuotes.SetColLabelSize(20)
        #Set the minimum acceptable column width to 0 to allow for the hidden column
        self.gridQuotes.SetColMinimalAcceptableWidth(0)
        # Set minimum acceptable widths for each column
        self.gridQuotes.SetColMinimalWidth(0, 30)
        self.gridQuotes.SetColMinimalWidth(1, 30)
        self.gridQuotes.SetColMinimalWidth(2, 30)
        self.gridQuotes.SetColMinimalWidth(3, 0)
        # Set Default Text in the Header row
        self.gridQuotes.SetColLabelValue(0, _("Position"))
        self.gridQuotes.SetColLabelValue(1, _("Item ID"))
        self.gridQuotes.SetColLabelValue(2, _("Keywords"))
        # We don't need Row labels
        self.gridQuotes.SetRowLabelSize(0)
        # Set the column widths
        self.gridQuotes.SetColSize(0, 65)
        if width > 330:
            self.gridQuotes.SetColSize(1, width - 185)
        else:
            self.gridQuotes.SetColSize(1, 140)
        self.gridQuotes.SetColSize(2, 250)
        # The 3rd column should not be visible.  The data is necessary for loading clips, but should not be displayed.
        self.gridQuotes.SetColSize(3, 0)
        self.gridQuotes.SetColSize(4, 0)

        # Define the Grid Double-Click event
        grid.EVT_GRID_CELL_LEFT_DCLICK(self.gridQuotes, self.OnCellLeftDClick)

        # Create a variable to track whether the screen needs to be re-drawn
        self.redraw = False
        self.redrawComplete = True
        # Define the Key Down Event Handler
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        # Define the OnIdle event handler
        self.Bind(wx.EVT_IDLE, self.OnIdle)
        # Define the OnClose event handler
        ##        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Perform GUI Layout
        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        self.Layout()
Example #8
0
    def __init__(self, parent, seriesObj=None, episodeObj=None, TimeCode=None):
        """Initialize an Episode Clips Tab object.  If the TimeCode parameter is included, you get a Selected Clips Tab. """
        self.parent = parent
        # Initialize the ControlObject
        self.ControlObject = None
        # Make the initial data objects which are passed in available to the entire KeywordsTab object
        self.seriesObj = seriesObj
        self.episodeObj = episodeObj

        # Get the size of the parent window
        psize = parent.GetSizeTuple()
        # Determine the size of the panel to be placed on the dialog, slightly smaller than the parent window
        width = psize[0] - 13 
        height = psize[1] - 45

        # Create a Panel to put stuff on.  Use WANTS_CHARS style so the panel doesn't eat the Enter key.
        # (This panel implements the Episode Clips Tab!  All of the window and Notebook structure is provided by DataWindow.py.)
        wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS, size=(width, height), name='EpisodeClipsTabPanel')

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Create a Grid Control on the panel where the clip data will be displayed
        self.gridClips = grid.Grid(self, -1)
        mainSizer.Add(self.gridClips, 1, wx.EXPAND)

        # Populate the Grid with initial values
        #   Grid is read-only, not editable
        self.gridClips.EnableEditing(False)
        #   Grid has 5 columns (two of which will not be visible), no rows initially
        self.gridClips.CreateGrid(1, 5)
        # Set the height of the Column Headings
        self.gridClips.SetColLabelSize(20)
        #Set the minimum acceptable column width to 0 to allow for the hidden column
        self.gridClips.SetColMinimalAcceptableWidth(0)
        # Set minimum acceptable widths for each column
        self.gridClips.SetColMinimalWidth(0, 30)
        self.gridClips.SetColMinimalWidth(1, 30)
        self.gridClips.SetColMinimalWidth(2, 30)
        self.gridClips.SetColMinimalWidth(3, 0)
        # Set Default Text in the Header row
        self.gridClips.SetColLabelValue(0, _("Time"))
        self.gridClips.SetColLabelValue(1, _("Item ID"))
        self.gridClips.SetColLabelValue(2, _("Keywords"))
        # We don't need Row labels
        self.gridClips.SetRowLabelSize(0)
        # Set the column widths
        self.gridClips.SetColSize(0, 65)
        if width > 330:
            self.gridClips.SetColSize(1, width - 185)
        else:
            self.gridClips.SetColSize(1, 140)
        self.gridClips.SetColSize(2, 250)
        # The 3rd column should not be visible.  The data is necessary for loading clips, but should not be displayed.
        self.gridClips.SetColSize(3, 0)
        self.gridClips.SetColSize(4, 0)

        # Display Cell Data
#        self.DisplayCells(TimeCode)
        
        # Define the Grid Double-Click event
        grid.EVT_GRID_CELL_LEFT_DCLICK(self.gridClips, self.OnCellLeftDClick)

        # Define the Key Down Event Handler
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        
        # Perform GUI Layout
        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        self.Layout()