39 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
from    QT                  import QtWidgets, QtGui, QT
 | 
						|
from    _With_Table_Widget_ import _With_Table_Widget_
 | 
						|
from    App_State           import App_State
 | 
						|
import  schema
 | 
						|
 | 
						|
class Action_List (_With_Table_Widget_) :
 | 
						|
 | 
						|
    settings_group  = "order-list"
 | 
						|
    Columns         = \
 | 
						|
        ("Datum", "Benutzer", "Kind", "Text")
 | 
						|
 | 
						|
    def __init__ (self, actions, parent = None) :
 | 
						|
        super ().__init__ (parent = parent)
 | 
						|
        self._view.setRowCount (len (actions))
 | 
						|
        for row, a in enumerate (actions) :
 | 
						|
            self._add_read_only_string (row, 0, a.date.strftime ("%H:%M:%S %d-%d-%Y"))
 | 
						|
            self._add_read_only_string (row, 1, a.user.username)
 | 
						|
            self._add_read_only_string (row, 2,
 | 
						|
                                         App_State.Action_Kind [a.action_kind])
 | 
						|
            self._add_read_only_string (row, 3, a.action)
 | 
						|
        header =self._view.horizontalHeader ()
 | 
						|
        header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)        
 | 
						|
    # end def __init__
 | 
						|
    
 | 
						|
# end class Action_List
 | 
						|
        
 | 
						|
class Action_Dialog (QtWidgets.QDialog) :
 | 
						|
 | 
						|
    def __init__ (self, actions) :
 | 
						|
        super ().__init__ ()
 | 
						|
        self.setMinimumSize (640, 400)
 | 
						|
        l = QtWidgets.QHBoxLayout (self)
 | 
						|
        self.action_list = Action_List (actions)
 | 
						|
        l.addWidget (self.action_list)
 | 
						|
        self.setModal (False)
 | 
						|
    # end def __init__
 | 
						|
    
 | 
						|
 | 
						|
# end class Action_Dialog |