The excel operator is composed by three parts, model to store the data, view to show content and controller to handle all the actions.
There are six sub-packages in the Model package.
- Workbook
- Workcell
- Worksheet
- CASbook
- CASsheet
- PSbook
- PSsheet
Folder structure
model
├── __init__.py
├── Workbook.py
├── Workcell.py
├── Worksheet.py
├── CASbook.py
├── CASsheet.py
├── PSbook.py
└── PSsheet.py
There is only one class in Workbook package.
- class Workbook(object)
The Workbook is a abstract class that used to store the instance created by xlwings and openpyxl.
- def __init__(self,workbook = None,app = None)
- def __del__(self)
- def init_book(self,workbook,app)
- def init_model(self)
- def update_model(self)
- def update_sheet_name_model(self)
- def load_sheets(self,sheet_cls,sheets,sheets_wr)
- def load_sheets_name(self,sheets)
- def open(self,path_name)
- def save_as(self,path_name)
- def save(self)
- def recover(self,direction)
- def sheets(self)
- def sheet_name_model(self)
- def workbook(self)
- def workbook_wr(self)
- def workbook_name(self)
- def sheetnames(self)
- _workbook
- _workbook_wr
- _workbook_name
- _sheets
- _sheet_name_model
The Workbook provides a series of interface that could be used for both PS file and CAS file. If there are some particular methods only for PS file or CAS file, they will be defined in PSbook class and CASbook class.
Store the workbook instance created by openpyxl for reading.
Store the workbook instance created by xlwings for writing.
Store the name of the workbook.
A list to store all the sheets object.
A Qt item model object for presenting sheets name.
Create a new Workbook instance with the given workbook and app.
Deletes all sheets hold by the workbook instance and release the workbook instance.
Load workbook by xlwings and openpyxl, the xlwings is used to write and the openpyxl is used to read.
Initialize the workbook's name and create a new model to hold all the sheet's name.
Whenever workbook changed, call update_model() to keep the Workbook model update.
For now, the Workbook only keep a sheet name model.
Read the sheet's name and fill the model.
Called by the child class.
sheet_cls provide a specified class with some special method that could be applied for the sheet.
sheets is used to read.
sheets_wr is used to write.
This method is used to load every sheet's name to a list.
Virtual function, only a placeholder that waiting for overwrite by child class.
Save the workbook with the given path_name by xlwings.
Virtual function, only a placeholder that waiting for overwrite by child class.
Virtual function, only a placeholder that waiting for overwrite by child class.
Property member, provide a interface to access _sheets.
Property member, provide a interface to access _sheet_name_model.
Property member, provide a interface to access _workbook.
Property member, provide a interface to access _workbook_wr.
Property member, provide a interface to access _workbook_name.
Property member, provide a interface to access _workbook.sheetname.
The Workcell package contains four classes.
- class Workcell(object)
- class XmlName(Workcell)
- class Header(Workcell)
- class Status(Workcell)
- def __init__(self,cell = None,sheet_wr = None,header = None,xmlname = None)
- def cell(self)
- def row(self)
- def col(self)
- def column(self)
- def col_letter(self)
- def value(self)
- def value(self,value)
- def header(self)
- def xmlname(self)
- def sheet_wr(self)
- _cell
- _header
- _xmlname
- _sheet_wr
Workcell is a base class that provides interfaces to access cells via xlwings or openpyxl.
Store the cell instance created by openpyxl.
Store the Header object related to this cell.
Store the Xmlname object related to this cell.
Store the sheet which this cell belongs.
Create a new Workcell object with the given cell, sheet_wr, header, xmlname.
Property member, provide a interface to access _cell.
Property member, provide a interface to access _cell.row.
Property member, provide a interface to access _cell.col_idx.
Property member, provide a interface to access _cell.col_idx.
Property member, provide a interface to access _cell.column.
Property member, provide a interface to read _cell.value.
It is completed by openpyxl.
Property member, provide a interface to write _sheet_wr.api.Range(self.row,self.column).value.
It is completed by xlwings.
Property member, provide a interface to access _header.
Property member, provide a interface to access _xmlname.
Property member, provide a interface to access _sheet_wr.
Inherits Workcell.
- def __init__(self,cell = None,sheet_wr = None)
- def get_item_by_header(self,header)
Inherits Workcell.
Xmlname is a child class of Workcell. It is used to store the xmlname cells.
Create a new Xmlname object with given cell and sheet_wr.
Return the cell which is located at the cross of the row of xmlanme and the column of header.
Inherits Workcell.
- def __init__(self,cell = None,sheet_wr = None)
- def get_item_by_xmlname(self,xmlname)
Inherits Workcell.
Header is a child class of Workcell. It is used to store the header cells.
Create a new Header object with given cell and sheet_wr.
Return the cell which is located at the cross of the row of xmlanme and the column of header.
Inherits Workcell.
- def __init__(self,cell = None,sheet_wr = None)
- def get_item_by_xmlname(self,xmlname)
Inherits Workcell.
Status is a child class of Workcell. It is used to store the status cells.
Create a new Header object with given cell and sheet_wr.
Return the cell which is located at the cross of the row of xmlanme and the column of Status.
The Worksheet package contains four classes.
- class Worksheet(object)
- class QPreviewItem(QStandardItem)
- class QComparisonItem(QStandardItem)
- class QHeaderItem(QStandardItem)
- def __init__(self,sheet = None,sheet_wr = None)
- def __del__(self)
- def init_sheet(self)
- def init_model(self)
- def update_model(self)
- def search_by_value(self,value)
- def search_header_by_value(self,value)
- def search_xmlname_by_value(self,value)
- def xml_names(self)
- def xml_names_value(self)
- def headers(self)
- def headers_value(self)
- def select_all_headers(self)
- def unselect_all_headers(self)
- def cell(self,row,col)
- def cell_value(self,row,col)
- def cell_wr(self,row,col)
- def cell_wr_value(self,row,col)
- def xmlname(self)
- def preview_model(self)
- def header_model(self)
- def header_list(self)
- def xml_name_model(self)
- def extended_preview_model(self)
- def checked_headers(self)
- def worksheet(self)
- def rows(self)
- def cols(self)
- def max_row(self)
- def min_row(self)
- def max_col(self)
- def min_col(self)
- _worksheet
- _worksheet_wr
- _xmlname
- _header_model
Worksheet is a abstract class to define the general methods of worksheet that could be applied on both PS file and CAS file. If there are some particular methods only for PS file or CAS file, they will be defined in PSsheet class and CASsheet class.
Store the worksheet object created by openpyxl for reading.
Store the worksheet object created by xlwings for writing.
Store the 'xmlname' cell object. If there is no 'xmlname', the value will be 'None'.
A Qt item model for storing the all the headers.
Create a new Worksheet object with the given sheet and sheet_wr.
Release all the _worksheet and _worksheet_wr.
Initialize the _xmlname.
Create a Qt item model to store all the headers.
Reload the _header_model and keep the model update.
Search and return the Workcell object by the value of targe cell.
Search and return the Header object by the value of target cell.
Search and return the Xmlname object by the value of target cell.
Return a list of Xmlname object which contains all the xmlnames in this worksheet.
Return a list of xmlname string of all the xmlnames in this worksheet.
Return a list of Header object which contains all the headers in this worksheet.
Return a list of header string of all the headers in this worksheet.
Set the states of all the items of _header_model to Qt.Checked.
Set the states of all the items of _header_model to Qt.Unchecked.
Return the specified cell with the given row and col via openpyxl.
Retrun the value of specified cell with the given row and col via openpyxl.
Return the specified cell with the given row and col via xlwings.
Return the value of specified cell with the given row and col via xlwings.
Property member, provide a interface to access the _xmlname.
Property member, provide a interface to access the _preview_model.
Property member, provide a interface to access the _header_model.
Property member. Return a list of header string of all the headers in this worksheet. If there is not a 'xmlname' cell, return a blank list instead.
Property member, provide a interface to access the _xml_name_model.
Property member, provide a interface to access the _extended_preview_model.
Return a list of all the checked item in _header_model.
Property member, provide a interface to access _worksheet.
Property member, provide a interface to access _worksheet.rows.
Property member, provide a interface to access _worksheet.columns.
Property member, provide a interface to access _worksheet.max_row.
Read from setup.ini.
Property member, provide a interface to access _worksheet.min_row.
Property member, provide a interface to access _worksheet.max_column.
Property member, provide a interface to access _worksheet.min_column.
Inherits QStandardItem.
- def __init__(self,cell)
- def cell(self)
- def value(self)
- def row(self)
- def col(self)
- def col_letter(self)
- _cell
QPreviewItem inherits from QStandardItem.
Store the Workcell object.
Create a new QPreviewItem object with the given cell.
Property member, provide a interface to access the _cell.
Property member, provide a interface to access the _cell.value.
Property member, provide a interface to access the _cell.row.
Property member, provide a interface to access the _cell.col.
Property member, provide a interface to access the _cell.col_letter.
Inherits QStandardItem.
- def __init__(self,cell)
- def cell(self)
- def value(self)
- def row(self)
- def col(self)
- def col_letter(self)
- _cell
QComparisonItem inherits from QStandardItem.
Store the Workcell object.
Create a new QComparisonItem object with the given cell.
Property member, provide a interface to access the _cell.
Property member, provide a interface to access the _cell.value.
Property member, provide a interface to access the _cell.row.
Property member, provide a interface to access the _cell.col.
Property member, provide a interface to access the _cell.col_letter.
Inherits QStandardItem.
- def __init__(self,cell)
- def get_item_by_xmlname(self,xmlanme)
- def cell(self)
- def value(self)
- def row(self)
- def col(self)
- def col_letter(self)
- _cell
QHeaderItem inherits from QStandardItem.
Store the Workcell object.
Create a new QHeaderItem object with the given cell.
Return the cell object which is located at the cross of the row of xmlname and the column of _cell.
Property member, provide a interface to access the _cell.
Property member, provide a interface to access the _cell.value.
Property member, provide a interface to access the _cell.row.
Property member, provide a interface to access the _cell.col.
Property member, provide a interface to access the _cell.col_letter.
The CASbook package contains one class.
- class CASbook(Workbook)
Inherits Workbook.
- def __init__(self,file_name = None,app = None)
- def init_cas_book(self)
Inherits from Workbook class.
The only difference between CASbook and PSbook is about the load_sheets.
load_sheets is used to create specified Worksheet objects for each sheet and load them into a list.
For CASbook, the specified Worksheet object should be CASsheet.
Create a new CASbook objects with the given file_name and app.
Create CASsheet objects for each worksheet and load them into a list by load_sheets.
The CASsheet package contains one class.
- class CASsheet(Worksheet)
Inherits Worksheet.
- def __init__(self,sheet = None,sheet_wr = None)
- def init_cas_sheet(self)
- def cell(self,row,col)
- _subject_matter
- _container_name
While initializing CASsheet object, it will search for two headers, 'Subject Matter Functional Area' and 'Container Name Technical Specification'.
Store the QHeaderItem object as the searching result of cell 'Subject Matter Functional Area'.
Store the QHeaderItem object as the searching result of cell 'Container Name Technical Specification'.
Create a new CASsheet object with the given sheet and sheet_wr.
If there is a 'xmlname' cell in this worksheet, search for 'Subject Matter Functional Area' and 'Container Name Technical Specification' and store the result.
Return the cell object via xlwings.
The PSbook package contains one class.
- class PSbook(Workbook)
Inherits Workbook.
- def __init__(self,file_name = None,app = None)
- def init_ps_book(self)
Inherits from Workbook class.
The only difference between CASbook and PSbook is about the load_sheets.
load_sheets is used to create specified Worksheet objects for each sheet and load them into a list.
For PSbook, the specified Worksheet object should be PSsheet.
Create a new PSbook objects with the given file_name and app.
Create PSsheet objects for each worksheet and load them into a list by load_sheets.
The PSsheet package contains one class.
- class PSsheet(Worksheet)
Inherits Worksheet.
- def __init__(self,sheet = None,sheet_wr = None)
- def __del__(self)
- def init_ps_sheet(self)
- def init_ps_model(self)
- def update_model(self)
- def status(self)
- def cell(self,row,col)
- def auto_fit(self,cols)
- def add_row(self,start_pos,offset,orientation)
- def delete_row(self,start_pos,offset)
- def lock_row(self,row,status)
- def lock_sheet(self)
- def unlock_sheet(self)
- def unlock_all_cells(self)
- def extended_preview_model(self)
- def extended_preview_model_list(self)
- def preview_model(self)
- _status
- _subject_matter
- _container_name
- _preview_model
- _preview_model_list
- _extended_preview_model
- _extended_preview_model_list
PSsheet class provides more interfaces than Worksheet.The class hold two data model, _preview_model for the four columns preview window and _extended_preview_model for the full content preview mode.It also allow user to append, delete and lock rows in the worksheet.
Store the QHeaderItem object as the searching result of cell 'Status(POR,INIT,PREV)'.
Store the QHeaderItem object as the searching result of cell 'Subject Matter Functional Area'.
Store the QHeaderItem object as the searching result of cell 'Container Name Technical Specification'.
Store the data model for the content of four columns preview window.
Convert _preview_model to list for transmitting between multiprocessing.
Store the data model for the full content of preview window.
Create a new PSsheet object with the given sheet and sheet_wr.
Initialize the _preview_model, _preview_model_list, _extended_preview_model and _extended_preview_model_list.
Search for all the headers and constract the _preview_model.
Release the _preview_model and _extended_preview_model.
Search for headers that
Constract the data model for four columns preview window.
Re-initialize the _preview_model and keep the content update.
Return a list of Status object which contains all the status items in this worksheet.
Return the cell object for reading via openpyxl.
Adjust the columns width automatically with the given cols. cols should be a collection of the columns you want to adjust.
Insert several rows below the specified row with the given start_pos, offset, orientation.
start_pos indicates the position of the row that you want to insert below.
offset represents the number of rows you want to insert.
orientation represents the direction of insertion.
Delete several rows from the specified row with the given start_pos, offset.
start_pos indicates the start position of the row that you want to delete.
offset represents the number of rows you want to delete.
Set the row's protection mode with the given row and status.
row represents the row you want to handle.
status represents the target status you want to set. For example, True stands for locked and False stands for unlocked.
Set the worksheet's protection mode to locked.
Set the worksheet's protection mode to unlocked.
Set the protection mode of all the cells in this worksheet to unlocked.
Work through the whole worksheet and constrcut a data model for the full content preview window.
The construction of data model would only be executed for the first time. The following calls would return the result of the first call.
Convert _extended_preview_model to string list to adapter the multiproccessing communication on Windows.
Property member, provide a interface to access the _preview_model_list.
There are four sub-packages in the Model package.
- ExtendedPreview
- ExtendedPreviewUI
- Window
- WindowUI
Folder structure
view
├── ExtendedPreview.py
├── ExtendedPreview.ui
├── ExtendedPreviewUI.py
├── icon.png
├── __init__.py
├── resource.qrc
├── resource_rc.py
├── tool.png
├── Window.py
├── Window.ui
└── WindowUI.py
There is only one class in ExtendedPreview package.
- class ExtendedPreview(QMainWindow)
Inherits QMainWindow.
- def __init__(self,model = None)
- def init_Form(self)
- def init_model(self,model)
- def update_extended_preview(self,array)
- ui
ExtendedPreivew is used to create the extended preview graphic user interface. There is a data model that contains all the necessary message for presenting full content of the worksheet.
Store the ExtendedPreviewUI object.
Create a new ExtendedPreview object with the given model.
Initialize the Form UI object.
Initialize the data model for presenting full content of the worksheet.
Refresh the extended_preview data model to keep the content update.
There is only one class in ExtendedPreviewUI package.
- class Ui_Form(object)
Generated by pyuic4.
- def setupUi(self, Form)
- def retranslateUi(self, Form)
- extended_preview
Please refer to Qt official documentation.
Please refer to Qt official documentation.
There are only one class in Window package.
- class Window(QMainWindow)
Inherits QMainWindow.
- def __init__(self)
- def init_Window(self)
- def bind_open_cas(self,func)
- def bind_open_ps(self,func)
- def bind_save_cas(self,func)
- def bind_save_ps(self,func)
- def bind_saveas_cas(self,func)
- def bind_saveas_ps(self,func)
- def bind_select_cas_sheet(self,func)
- def bind_select_ps_sheet(self,func)
- def bind_select_preview(self,func)
- def bind_sync_ps_to_cas(self,func)
- def bind_sync_cas_to_ps(self,func)
- def bind_sync_select_all_ps_headers(self,func)
- def bind_sync_select_all_cas_headers(self,func)
- def bind_comparison_start(self,func)
- def bind_comparison_delete(self,func)
- def bind_comparison_append(self,func)
- def bind_comparison_select_all_delete(self,func)
- def bind_comparison_select_all_append(self,func)
- def bind_preview_add(self,func)
- def bind_preview_delete(self,func)
- def bind_preview_lock(self,func)
- def bind_undo_cas(self,func)
- def bind_undo_ps(self,func)
- def bind_select_extended_preview(self,func)
- def bind_ps_header_changed(self,func)
- def bind_cas_header_changed(self,func)
- def bind_comparison_append_list_changed(self,func)
- def bind_comparison_delete_list_changed(self,func)
- def bind_search(self,func)
- def update_cas_file(self,filename)
- def update_ps_file(self,filename)
- def update_cas_sheets(self,sheetnames)
- def update_ps_sheets(self,sheetnames)
- def update_preview(self,items)
- def search_preview(self)
- def update_ps_header(self,headers)
- def update_cas_header(self,headers)
- def update_ps_header_selected(self,idx)
- def update_cas_header_selected(self,idx)
- def update_comparison_delete_list(self,deletes)
- def update_comparison_append_list(self,appends)
- def update_message(self,model)
- def update_msg(self,model)
- def update_selected_cell(self,model)
- def update_progressBar(self,model)
- def open_file_confirm(self)
- def pop_up_message(self,msg)
- ui
- previews_pattern
- match_list
- match_current_postion
Window is used to create the main program graphic user interface.
Store the ExtendedPreviewUI object.
Store the search pattern used by search function.
Store the result of search as a list.
Store the current postion of the whole match_list.
Create a new Window object.
Create WindowUI object and setup the Ui.
Set the window state to Qt.WindowMaximized.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Bind UI event to the given func.
Refresh UI with the given filename.
Refresh UI with the given filename.
Refresh UI with the given sheetnames.
Refresh UI with the given sheetnames.
Refresh UI with the given itemss.
Search the preview model with previews_pattern and store the result in match_list as a list.
Refresh UI with the given headers.
Refresh UI with the given headers.
Refresh UI with the given idx.
Refresh UI with the given idx.
Refresh UI with the given deletes.
Refresh UI with the given appends.
Refresh UI with the given model.
Refresh UI with the given model.
Refresh UI with the given model.
Refresh UI with the given model.
Open a file selection dialog for open file confirm.
Pop up a warning with the given msg.
There is only one class in WindowUI package.
- class Ui_MainWindow(object)
Generated by pyuic4.
- def setupUi(self, MainWindow)
- def retranslateUi(self, MainWindow)
- centralwidget
- gridLayout_7
- horizontalLayout
- verticalLayout
- gridLayout
- label
- name_cas
- sheets_cas
- open_cas
- save_cas
- saveas_cas
- undo_cas
- label_2
- name_ps
- sheets_ps
- open_ps
- save_ps
- saveas_ps
- undo_ps
- gridLayout_3
- label_5
- comparison_start
- label_7
- label_8
- comparison_delete_list
- comparison_append_list
- comparison_delete
- comparison_select_all_append
- comparison_append
- comparison_select_all_delete
- gridLayout_6
- label_3
- label_4
- label_6
- ps_header
- cas_header
- sync_ps_to_cas
- sync_select_all_cas
- sync_cas_to_ps
- sync_select_all_ps
- verticalLayout_2
- gridLayout_4
- preview
- preview_add
- preview_delete
- preview_lock
- extended_preview
- gridLayout_5
- label_9
- selected_row
- label_10
- selected_col
- progressBar
- msg
- menubar
- statusbar
Please refer to Qt official documentation.
Please refer to Qt official documentation.
There are two sub-packages in the Controller package.
- FileStack
- MainController
Folder structure
controller/
├── FileStack.py
├── __init__.py
└── MainController.py
There are three classes in FileStack package.
- class FileStack(object)
- class CasPack(object)
- class PsPack(object)
- def __init__(self,max_depth = 10)
- def push(self,pack)
- def pop(self)
- def is_stack_full(self)
- def is_stack_empty(self)
- def fileStack(self)
- def len(self)
- def currentFile(self)
- _max_depth
- _file_stack
- _current_depth
FileStack is used to store the files for the recovery action.
The maximum number of stored files could be set. If the stack is full, the oldest file will be discard to store the lastest file.
Store the maximun number of stored files.
Store the list of stored file.
Store the current number of stored files.
Create a new FileStack object and initialize the file list for storing files.
The default maximun number of stored files is 10.
Push a file pack into the _file_stack.
If the stack is full, the oldest file will be discarded to store the lastest file.
Pop out the lastest file.
If stack is empty, return 'None'.
Return True if the stack is full, else return False.
Return True if the stack is empty, else return False.
Property member, provide a interface to access _file_stack.
Property member, return the current length of _file_stack.
Property member, provide a interface to access the lastest file in stack.
- def __init__(self,action = None,fileName = None)
- def action(self)
- def file_name(self)
- _action
- _file_name
CasPack is a collection that contains all the nessecery informations of a CAS file.
Store the description of last action applied on _file_name.
Store the name of the stored file.
Create a new CasPack object with the given action and fileName.
Property member, provide a interface to access the _action.
Property member, provide a interface to access the _file_name.
- def __init__(self,action = None,fileName = None)
- def action(self)
- def file_name(self)
- _action
- _file_name
PsPack is a collection that contains all the nessecery informations of a PS file.
Store the description of last action applied on _file_name.
Store the name of the stored file.
Create a new PsPack object with the given action and fileName.
Property member, provide a interface to access the _action.
Property member, provide a interface to access the _file_name.
There are four classes in MainController package.
- class MainControllerUI(QObject)
- class MainControllerUILoop(QThread)
- class MainController(object)
- class QComparisonItem(QStandardItem)
MainControllerUI is used to hold the instance of the GUI and handle all the actions triggered by user.
Inherits QObject.
- def __init__(self,queue_wr=None,queue_rd=None)
- def run(self)
- def __del__(self)
- def init_GUI(self)
- def init_worker(self)
- def bind_GUI_event(self)
- def open_cas(self)
- def open_ps(self)
- def save_cas(self)
- def save_ps(self)
- def saveas_cas(self)
- def saveas_ps(self)
- def select_cas_sheet(self,index)
- def select_ps_sheet(self,index)
- def select_preview(self,index)
- def select_sync_ps_to_cas(self)
- def select_sync_cas_to_ps(self)
- def select_sync_select_all_ps_headers(self,state)
- def select_sync_select_all_cas_headers(self,state)
- def comparison_start(self)
- def comparison_delete(self)
- def comparison_append(self)
- def comparison_select_all_delete(self,state)
- def comparison_select_all_append(self,state)
- def preview_add(self)
- def preview_delete(self)
- def preview_lock(self)
- def undo_cas(self)
- def undo_ps(self)
- def select_extended_preview(self)
- def ps_header_changed(self,index)
- def cas_header_changed(self,index)
- def comparison_append_list_changed(self,index)
- def comparison_delete_list_changed(self,index)
- def set_CASbook_modified(self,state)
- def set_PSbook_modified(self,state)
- def animation_progressBar(self,model)
- def bind_worker_event(self,worker)
- def show_GUI(self)
- _application
- _progressBar_status
- _CASbook_modified
- _PSbook_modified
- _queue_wr
- _queue_rd
- _status
Before a MainControllerUI object start to deal with the actions triggered by user, it spawned a child thread to receive messages from _queue_rd.
Store the Qt application object.
Store the status of progress bar.
It is used to indicate the status of CAS file.
If CAS file has been modified, the value should be True, otherwise it should be False.
It is used to indicate the status of PS file.
If PS file has been modified, the value should be True, otherwise it should be False.
To communicate with the background data handler process. Write only.
To communicate with the background data handler process. Read only.
Indicate the status of this process.
If the object is runing, the value should be True, otherwise it should be False.
Create a new MainControllerUI object with the given queue_wr and queue_rd.
Initialize all the status.
Start the graphic user interface.
Safety exit the child thread.
Create application object, window object and extended preview window object.
Mount GUI event to it own functions.
Start a child thread for handling messages from data handler process.
Mount GUI event to it own functions.
Open a file selection dialog for open cas actions.
Open a file selection dialog for open ps actions.
Send 'save_cas' to _queue_wr.
Send 'save_ps' to _queue_wr.
Open a file selection dialog for saveas cas actions and send 'saveas_cas' to _queue_wr.
Open a file selection dialog for saveas ps actions and send 'saveas_ps' to _queue_wr.
Send 'select_cas_sheet' and index to _queue_wr.
Send 'select_ps_sheet' and index to _queue_wr.
Send 'select_preview' and index to _queue_wr.
Send 'select_sync_ps_to_cas' to _queue_wr.
Send 'select_sync_cas_to_ps' to _queue_wr.
Send 'select_sync_select_all_ps_headers' and state to _queue_wr.
Send 'select_sync_select_all_cas_headers' and state to _queue_wr.
Send 'comparison_start' to _queue_wr.
Send 'comparison_delete' to _queue_wr.
Send 'comparison_append' to _queue_wr.
Send 'comparison_select_all_delete' and state to _queue_wr.
Send 'comparison_select_all_append' and state to _queue_wr.
Send 'preview_add' to _queue_wr.
Send 'preview_delete' to _queue_wr.
Send 'preview_lock' to _queue_wr.
Send 'undo_cas' to _queue_wr.
Send 'undo_ps' to _queue_wr.
Send 'select_extended_preview' to _queue_wr.
Send 'ps_header_changed' and index to _queue_wr.
Send 'cas_header_changed' and index to _queue_wr.
Send 'comparison_append_list_changed' and index to _queue_wr.
Send 'comparison_delete_list_changed' and index to _queue_wr.
Set _CASbook_modified to the given state.
Set _PSbook_modified to the given state.
Refresh progress bar with the given model.
Bind child thread's signals to the slots of the main thread.
Please refer to the Qt official documentation.
Show GUI on screen.
MainControllerUILoop acts as a worker that handles messages for MainControllerUI. Inherits QThread.
- def __init__(self,queue_rd=None,parent=None)
- def run(self)
- def stop(self)
- _status
- _queue_rd
- signal_refresh_cas_book_name
- signal_refresh_ps_book_name
- signal_refresh_cas_sheet_name
- signal_refresh_ps_sheet_name
- signal_refresh_preview
- signal_refresh_ps_header
- signal_refresh_cas_header
- signal_refresh_comparison_delete_list
- signal_refresh_comparison_append_list
- signal_refresh_message
- signal_refresh_msg
- signal_refresh_warning
- signal_refresh_selected_cell
- signal_refresh_progressBar
- signal_animation_progressBar
- signal_refresh_ps_header_selected
- signal_refresh_cas_header_selected
- signal_refresh_extended_preview
- signal_set_CASbook_modified
- signal_set_PSbook_modified
The main task of MainControllerUILoop is to receive messages from MainController and forward the message by signal-slot connection to MainControllerUI.
Indicate the status of this process.
If the object is runing, the value should be True, otherwise it should be False.
To communicate with the background data handler process. Read only.
Qt signal, to trigger refresh_cas_book_name in MainControllerUI.
Qt signal, to trigger refresh_ps_book_name in MainControllerUI.
Qt signal, to trigger refresh_cas_sheet_name in MainControllerUI.
Qt signal, to trigger refresh_ps_sheet_name in MainControllerUI.
Qt signal, to trigger refresh_preview in MainControllerUI.
Qt signal, to trigger refresh_ps_header in MainControllerUI.
Qt signal, to trigger refresh_cas_header in MainControllerUI.
Qt signal, to trigger refresh_comparison_delete_list in MainControllerUI.
Qt signal, to trigger refresh_comparison_append_list in MainControllerUI.
Qt signal, to trigger refresh_message in MainControllerUI.
Qt signal, to trigger refresh_msg in MainControllerUI.
Qt signal, to trigger refresh_warning in MainControllerUI.
Qt signal, to trigger refresh_selected_cell in MainControllerUI.
Qt signal, to trigger refresh_progressBar in MainControllerUI.
Qt signal, to trigger animation_progressBar in MainControllerUI.
Qt signal, to trigger refresh_ps_header_selected in MainControllerUI.
Qt signal, to trigger refresh_cas_header_selected in MainControllerUI.
Qt signal, to trigger refresh_extended_preview in MainControllerUI.
Qt signal, to trigger set_CASbook_modified in MainControllerUI.
Qt signal, to trigger set_PSbook_modified in MainControllerUI.
Create a new MainControllerUILoop object with the given queue_rd and parent.
Keep receiving messages from _queue_rd.
Stop the main loop.
MainController is mainly responsible for the background operations on excel file.
- def __init__(self,queue_wr=None,queue_rd=None)
- def run(self)
- def stop(self)
- def __del__(self)
- def init_logging(self)
- def init_tmp_directory(self)
- def init_model(self)
- def init_file_stack(self)
- def start_xlwings_app(self)
- def open_cas_by_name(self,filename)
- def open_cas_by_bytesio(self,bytesio)
- def open_ps_by_name(self,filename)
- def open_ps_by_bytesio(self,bytesio)
- def save_cas(self)
- def save_ps(self)
- def saveas_cas(self,fileName)
- def saveas_ps(self,fileName)
- def select_cas_sheet(self,sheet_idx)
- def select_ps_sheet(self,sheet_idx)
- def select_preview(self,row,column)
- def select_sync_select_all_ps_headers(self,state)
- def select_sync_select_all_cas_headers(self,state)
- def select_sync_ps_to_cas(self)
- def select_sync_cas_to_ps(self)
- def comparison_start(self)
- def comparison_delete(self)
- def comparison_append(self)
- def comparison_select_all_delete(self,state)
- def comparison_select_all_append(self,state)
- def checked_delete(self)
- def checked_delete_count(self)
- def checked_append(self)
- def checked_append_count(self)
- def preview_add(self)
- def preview_delete(self)
- def preview_lock(self)
- def ps_header_changed(self,row,state)
- def cas_header_changed(self,row,state)
- def comparison_append_list_changed(self,row,state)
- def comparison_delete_list_changed(self,row,state)
- def recover_ps_sheet_selected(self)
- def recover_cas_sheet_selected(self)
- def store_ps_file(self,action)
- def store_ps_file_without_open(self,action)
- def store_cas_file(self,action)
- def store_cas_file_without_open(self,action)
- def copy_cas(self,filename)
- def copy_ps(self,filename)
- def undo_ps(self)
- def undo_cas(self)
- def select_extended_preview(self)
- def CASbook_modified(self)
- def CASbook_modified(self,value)
- def PSbook_modified(self)
- def PSbook_modified(self,value)
- def refresh_cas_book_name(self,model)
- def refresh_ps_book_name(self,model)
- def refresh_cas_sheet_name(self,model)
- def refresh_ps_sheet_name(self,model)
- def refresh_preview(self,model)
- def refresh_ps_header(self,model)
- def refresh_cas_header(self,model)
- def refresh_comparison_delete_list(self,model)
- def refresh_comparison_append_list(self,model)
- def refresh_msg(self,model)
- def refresh_warning(self,model)
- def refresh_selected_cell(self,model)
- def refresh_progressBar(self,model)
- def animation_progressBar(self,model)
- def refresh_ps_header_selected(self,model)
- def refresh_cas_header_selected(self,model)
- def refresh_extended_preview(self,model)
- _status
- _queue_wr
- _queue_rd
- _xw_app
- _xw_app_2
- _PSbook
- _PSbook_name
- _PSbook_sheets
- _PSbook_current_sheet
- _PSbook_current_sheet_idx
- _PSbook_current_sheet_name
- _PSbook_autosave_flag
- _PSbook_modified
- _CASbook
- _CASbook_name
- _CASbook_sheets
- _CASbook_current_sheet
- _CASbook_current_sheet_idx
- _CASbook_current_sheet_name
- _CASbook_autosave_flag
- _CASbook_modified
- _PSstack
- _CASstack
- _progressBar_status
Indicate the status of this process.
If the object is runing, the value should be True, otherwise it should be False.
To communicate with the GUI process. Write only.
To communicate with the GUI process. Read only.
Excel app 1, created by xlwings.
Excel app 2, created by xlwings.
Store the PSbook object.
Store the name of PSbook object.
Store the sheets of PSbook object.
Store the current sheet of PSbook object.
Store the index of the current sheet of PSbook object.
Store the name of the current sheet of PSbook object.
Indicate if the next step should be autosave.
Indicate if the PSbook has been modified.
Store the CASbook object.
Store the name of CASbook object.
Store the sheets of CASbook object.
Store the current sheet of CASbook object.
Store the index of the current sheet of CASbook object.
Store the name of the current sheet of CASbook object.
Indicate if the next step should be autosave.
Indicate if the CASbook has been modified.
Store the FileStack object for the PS file.
Store the FileStack object for the CAS file.
Store the status of progress bar.
Create a new MainController with the given queue_wr and queue_rd.
Initialize all the parameter.
Initialize the logging system.
Initialize the recovery system.
Start xlwings app.
Initialize the data model.
Run the main loop.
Stop the main loop.
Release PS workbook object and CAS workbook object.
Quit xlwings applications.
Remove the temporary directory.
Initialize the logging system.
Create temporary directory.
Initialize the data model for comparison.
Initialize the FileStack object.
Start xlwings application.
Open cas file by the given filename.
Initialize the data model and keep the content update.
An optional way to open a cas file.
Open ps file by the given filename.
Initialize the data model and keep the content update.
An optional way to open a ps file.
Save cas file.
Save ps file.
Save cas file with the given fileName.
Save ps file with the given fileName.
Switch current worksheet with the given sheet_idx.
Switch current worksheet with the given sheet_idx.
Update the _preview_selected_cell with the given row and column.
Update the data model status of ps current sheet with the given state.
Update the data model status of cas current sheet with the given state.
Sync the specified columns from ps sheet to cas sheet.
Sync the specified columns from cas sheet to ps sheet.
Compare the xmlnames in cas sheet and ps sheet. Send messages to show difference on GUI.
Delete the checked xmlnames in ps sheet.
Append the checked xmlnames below the _preview_selected_cell in ps sheet.
If _append_color is True, the appended cell will fill with COLOR.
COLOR is read from setup.ini.
Update the checked state of comparison delete list with the given state.
Update the checked state of comparison append list with the given state.
Return a list of the checked items in comparison delete list.
Return the number of the checked items in comparison delete list.
Return a list of the checked items in comparison append list.
Return the number of the checked items in comparison append list.
Append a blank row below the _preview_selected_cell.
Delete the whole row of the _preview_selected_cell.
Lock the rows whose 'status' equals 'POR'.
Keep ps header data model and the data hold by GUI in sync.
Keep cas header data model and the data hold by GUI in sync.
Keep the data model of comparison append item list and the data hold by GUI in sync.
Keep the data model of comparison delete item list and the data hold by GUI in sync.
Recover the current sheet of ps file to the last status in order to keep the GUI showing continuously.
Recover the current sheet of cas file to the last status in order to keep the GUI showing continuously.
Store the ps file for the file recovery and reopen it to keep content update.
Store the ps file for the file recovery.
Store the cas file for the file recovery and reopen it to keep content update.
Store the cas file for the file recovery.
Copy cas file right after you select the cas file in GUI.
Divide the modifications and the source file to avoid misoperations.
Copy ps file right after you select the ps file in GUI.
Divide the modifications and the source file to avoid misoperations.
Revert the last action applied on ps file.
Revert the last action applied on cas file.
Open the extended preview window.
Property member, provide a interface to accesss the _CASbook_modified.
Property member, provide a interface to write the _CASbook_modified.
Property member, provide a interface to accesss the _PSbook_modified.
Property member, provide a interface to write the _PSbook_modified.
Send 'refresh_cas_book_name' and the given model to _queue_wr.
Send 'refresh_ps_book_name' and the given model to _queue_wr.
Send 'refresh_cas_sheet_name' and the given model to _queue_wr.
Send 'refresh_ps_sheet_name' and the given model to _queue_wr.
Send 'refresh_preview' and the given model to _queue_wr.
Send 'refresh_ps_header' and the given model to _queue_wr.
Send 'refresh_cas_header' and the given model to _queue_wr.
Send 'refresh_comparison_delete_list' and the given model to _queue_wr.
Send 'refresh_comparison_append_list' and the given model to _queue_wr.
Send 'refresh_msg' and the given model to _queue_wr.
Record the given model into logging file.
Send 'refresh_warning' and the given model to _queue_wr.
Send 'refresh_selected_cell' and the given model to _queue_wr.
Send 'refresh_progressBar' and the given model to _queue_wr.
Send 'animation_progressBar' and the given model to _queue_wr.
Send 'refresh_ps_header_selected' and the given model to _queue_wr.
Send 'refresh_cas_header_selected' and the given model to _queue_wr.
Send 'refresh_extended_preview' and the given model to _queue_wr.
Inherits QStandardItem.
- def __init__(self,cell)
- def cell(self)
- def value(self)
- def col_letter(self)
- _cell
To store the items of the result of comparison.
Store the cell object.
Create a new QComparisonItem with the given cell.
Property member, provide a interface to access the _cell.
Property member, provide a interface to access the _cell.value.
Property member, provide a interface to access the _cell.col_letter.