def __init__(self): QWidget.__init__(self) self.title = "报告" self.__path = None self.__service = ReportDetService() # report view self.__wid_display = QWebView() # buttons _wid_buttons = ViewButtons( [dict(id="refresh", name=u'更新'), dict(id="export", name=u'导出')]) _wid_buttons.align_back() # main layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) _layout.setContentsMargins(0, 0, 0, 0)
def __init__(self): QWidget.__init__(self) self.title = u"窗口" # Current window id self.__window_id = None # Model self.__model = WindowModel() self.__model.usr_set_definition(def_view_window_def) # Control _control = WindowControl(def_view_window_def) # Data result display window _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Search condition self.__wid_search_cond = ViewSearch(def_view_window_def) self.__wid_search_cond.set_col_num(3) self.__wid_search_cond.create() # Buttons window _btn_definition = [ dict(id="refresh", name=u'刷新'), dict(id="search", name=u"查询"), dict(id="update", name=u"修改", type="CHECK"), dict(id="delete", name=u"删除") ] _wid_buttons = ViewButtons(_btn_definition) _wid_buttons.align_back() # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate)
def __init__(self): QWidget.__init__(self) # Current case id self.__step_id = None self.__win_operate = ViewOperate() # Model self.__model = StepDetModel() self.__model.usr_set_definition(def_view_step) # Control _control = StepDetControl(def_view_step) # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Context menu _menu_def = [ dict(NAME=u"增加", STR="sig_add"), dict(NAME=u"删除", STR="sig_del"), dict(NAME=u"增加数据", STR="sig_data") ] _wid_display.create_context_menu(_menu_def) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK") ], "VER") # win_add self.__win_add = ViewAdd(def_view_step) self.__win_add.sig_operate.connect(self.__win_operate.show) self.__win_operate.sig_submit.connect(self.get_operate) # win add data self.__win_data = ViewDataAdd() # Layout _layout = QHBoxLayout() _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) self.__win_add.sig_submit.connect(self.add) _wid_display.sig_context.connect(self.__context) # 右键菜单 _wid_display.clicked.connect(self.__model.usr_set_current_data)
def __init__(self, p_type=None): QWidget.__init__(self) self.title = u"选择用例" self.__type = "MULTI" if p_type is None else p_type # Model self.__model = CaseSelModel() self.__model.usr_set_definition(def_view_case_def) if "SINGLE" == self.__type: self.__model.usr_chk_able() # Control _control = CaseSelControl(def_view_case_def) # Search condition widget self.__wid_search_cond = ViewSearch(def_view_case_def) self.__wid_search_cond.set_col_num(2) self.__wid_search_cond.create() # Data result display widget _wid_display = ViewTree() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons widget if "SINGLE" == self.__type: button_def = [] else: button_def = [dict(id="select", name=u"选择")] button_def.extend([ dict(id="search", name=u"查询"), dict(id="cancel", name=u"取消")]) _wid_buttons = ViewButtons(button_def) # win_add self.__win_add = ViewAdd(def_view_case_def) # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) _wid_display.clicked.connect(self.__model.usr_set_current_data) _wid_display.doubleClicked.connect(self.__select_one)
def __init__(self, p_def): QWidget.__init__(self) self.__fields = p_def # 控件定义 self.widgets = dict() # 控件 _lay_inputs = QGridLayout() for _index in range(len(self.__fields)): if not self.__fields[_index]["ADD"]: continue _id = self.__fields[_index]["ID"] _type = self.__fields[_index]["TYPE"] _name = self.__fields[_index]["NAME"] _ess = self.__fields[_index]["ESSENTIAL"] _widget = create_editor(self, dict(TYPE=_type, SOURCE="ADD", FLAG=_id)) self.widgets[_id] = dict(TYPE=_type, NAME=_name, WIDGET=_widget, ESSENTIAL=_ess) if "OPERATE" == _type: _widget.sig_operate.connect(self.sig_operate.emit) _label = QLabel(("*" if _ess else " ") + _name + ":") _lay_inputs.addWidget(_label, _index, 0) _lay_inputs.addWidget(self.widgets[_id]["WIDGET"], _index, 1) buttuns = ViewButtons( [dict(id="submit", name=u"提交"), dict(id="cancel", name=u"取消")]) lay_main = QVBoxLayout() lay_main.addLayout(_lay_inputs) lay_main.addWidget(buttuns) self.setLayout(lay_main) buttuns.sig_clicked.connect(self.__operate) self.setStyleSheet(get_theme("Input"))
def __init__(self, p_data): QWidget.__init__(self) _batch_no = p_data["no"] self.__batch_id = p_data["id"] self.title = _batch_no # Model self.__model = BatchDetModel() self.__model.usr_set_definition(def_view_batch_det) # Control _control = BatchDetControl(def_view_batch_det) # Search condition widget self.__wid_search_cond = ViewSearch(def_view_batch_det) self.__wid_search_cond.create() # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="search", name=u"查询") ]) # win_add self.__win_add = ViewCaseSelMag() # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) self.__win_add.sig_selected.connect(self.add)
def __init__(self): QWidget.__init__(self) self.title = u"数据管理" # Model self.__model = DataModel() self.__model.usr_set_definition(def_view_data) # Control _control = DataControl(def_view_data) # Search condition widget self.__wid_search_cond = ViewSearch(def_view_data) self.__wid_search_cond.set_col_num(3) self.__wid_search_cond.create() # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK"), dict(id="search", name=u"查询") ]) # win_add self.__win_add = ViewAdd(def_view_data) # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) self.__win_add.sig_submit[dict].connect(self.add)
def __init__(self): QWidget.__init__(self) # Current page id self.__page_id = None # Model self.__model = PageDetModel() self.__model.usr_set_definition(def_view_page_det) # Control _control = PageDetControl(def_view_page_det) # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK") ]) # win_add self.__win_add = ViewAdd(def_view_page_det) # Layout _layout = QVBoxLayout() _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) _wid_display.clicked[QModelIndex].connect(self.__page_select) self.__win_add.sig_submit[dict].connect(self.add)
def __init__(self): QWidget.__init__(self) self.title = u"选择用例" # Model self.__model = CaseSelModel() self.__model.usr_set_definition(def_view_case_def) # Control _control = CaseSelControl(def_view_case_def) # Search condition widget self.__wid_search_cond = ViewSearch(def_view_case_def) self.__wid_search_cond.set_col_num(2) self.__wid_search_cond.create() # Data result display widget _wid_display = ViewTree() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons widget _wid_buttons = ViewButtons([ dict(id="select", name=u"选择"), dict(id="search", name=u"查询"), dict(id="cancel", name=u"取消") ]) # win_add self.__win_add = ViewAdd(def_view_case_def) # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate)
def __init__(self): QWidget.__init__(self) self.title = u"执行列表" self.__service = RunDefService() self.__threads = [] # Model self.__model = RunDefModel() self.__model.usr_set_definition(def_view_run_def) # Control _control = RunDefControl(def_view_run_def) # Data result display widget _wid_display = ViewTree() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons window _wid_buttons = ViewButtons([ dict(id="add", name=u'增加'), dict(id="delete", name=u"删除"), dict(id="search", name=u'查询'), dict(id="run", name=u"执行") ]) # Layout _layout = QVBoxLayout() _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) _layout.setContentsMargins(0, 0, 0, 0) _wid_display.clicked.connect(self.__model.usr_set_current_data) _wid_buttons.sig_clicked.connect(self.__operate) _wid_display.clicked.connect(self.select)
def __init__(self): QWidget.__init__(self) # Model self.__model = WidgetSelectModel() self.__model.usr_set_definition(def_view_widget_def) self.__model.usr_chk_able() # Control _control = WidgetSelectControl(def_view_widget_def) # Search condition widget self.__wid_search_cond = ViewSearch(def_view_widget_def) self.__wid_search_cond.set_col_num(2) self.__wid_search_cond.create() # Data result display widget _wid_display = ViewTree() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons widget _wid_buttons = ViewButtons([dict(id="search", name=u"查询")]) # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) _wid_display.doubleClicked.connect(self.select)
def __init__(self): QWidget.__init__(self) self.title = u"计划管理" self.__service = BatchDefService() # Model self.__model = BatchDefModel() self.__model.usr_set_definition(def_view_batch_def) # Control _control = BatchDefControl(def_view_batch_def) # Search condition widget self.__wid_search_cond = ViewSearch(def_view_batch_def) self.__wid_search_cond.create() # Data result display widget _wid_display = ViewTree() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Context menu _wid_display.create_context_menu([ dict(NAME=u"增加", STR="sig_add"), dict(NAME=u"删除", STR="sig_del"), dict(NAME=u"增加数据", STR="sig_data"), dict(NAME=u"添加至运行", STR="sig_run") ]) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK"), dict(id="search", name=u"查询") ]) # win_add self.__win_add = ViewAdd(def_view_batch_def) # win add data self.__win_data = ViewDataAdd() # Layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) self.__win_add.sig_submit[dict].connect(self.add) _wid_display.doubleClicked[QModelIndex].connect(self.__batch_detail) _wid_display.sig_context.connect(self.__context) # 右键菜单 _wid_display.clicked.connect(self.__model.usr_set_current_data)
def __init__(self, p_type=None): """ 支持选择类型,选择时按钮/查询条件/查询方式都有不同 :param p_type: :return: """ QWidget.__init__(self) self.__type = p_type # Model self.__model = WidgetDefModel() self.__model.usr_set_definition(def_view_widget_def) # Control _control = WidgetDefControl(def_view_widget_def) # Search if self.__type is not None: self.__wid_search_cond = ViewSearch(def_view_widget_def) self.__wid_search_cond.set_col_num(2) self.__wid_search_cond.create() else: self.__wid_search_cond = None # Data result display widget _wid_display = ViewTree() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Buttons window btn_definition = [] if self.__type is None: btn_definition.append(dict(id="add", name=u'增加')), btn_definition.append(dict(id="delete", name=u"删除")) btn_definition.append(dict(id="update", name=u"修改", type="CHECK")) btn_definition.append(dict(id="search", name=u"查询")) _wid_buttons = ViewButtons(btn_definition) _wid_buttons.align_back() # win_add self.__win_add = ViewAdd(def_view_widget_def) # Layout _layout = QVBoxLayout() if self.__type is not None: _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # connection self.__win_add.sig_submit[dict].connect(self.add) _wid_buttons.sig_clicked.connect(self.__operate) if self.__type is None: _wid_display.clicked[QModelIndex].connect(self.__widget_detail) else: _wid_display.doubleClicked[QModelIndex].connect( self.__widget_detail)
def __init__(self): QWidget.__init__(self) self.__step_id = None self.__service_step_def = StepService() # Current case id self.__step_type = None self.__win_operate = ViewOperate() # Model self.__model = ItemModel() self.__model.usr_set_definition(def_view_item) # Control _control = ItemControl(def_view_item) # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Context menu _menu_def = [dict(NAME=u"增加", STR="sig_add"), dict(NAME=u"删除", STR="sig_del"), dict(NAME=u"增加数据", STR="sig_data")] _wid_display.create_context_menu(_menu_def) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK") ], "VER") # 新增 item 窗口 self.__win_add_item = ViewAdd(def_view_item) # 新增 func 窗口 self.__win_add_func = ViewCaseSelMag("SINGLE") # win add data self.__win_data = ViewDataAdd() # Layout _layout = QHBoxLayout() _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # Connection self.__win_add_item.sig_operate.connect(self.__win_operate.show) # 显示操作选择框 self.__win_add_item.sig_submit.connect(self.add_item) # 新增 self.__win_add_func.sig_selected.connect(self.add_func) # 新增 self.__win_operate.sig_submit.connect(self.get_operate) _wid_buttons.sig_clicked.connect(self.__operate) # 按钮点击 _wid_display.sig_context.connect(self.__context) # 右键菜单 _wid_display.clicked.connect(self.__model.usr_set_current_data) # 单击
def __init__(self, p_id): QWidget.__init__(self) self.__case_id = p_id # Model self.__model = CaseDetModel() self.__model.usr_set_definition(def_view_case_det) self.__model.usr_search({"case_id": self.__case_id}) # Control _control = CaseDetControl(def_view_case_det) # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # 界面列宽自适应 # _wid_display.resizeColumnsToContents() # Context menu _menu_def = [ dict(NAME=u"增加", STR="sig_add"), dict(NAME=u"删除", STR="sig_del"), dict(NAME=u"增加数据", STR="sig_data") ] _wid_display.create_context_menu(_menu_def) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK") ], "VER") # win_add self.__win_add = ViewAdd(def_view_case_det) # win add data self.__win_data = ViewDataAdd() # Layout _layout = QHBoxLayout() _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) _wid_display.clicked.connect(self.__selected) self.__win_add.sig_submit.connect(self.add) _wid_display.sig_context.connect(self.__context) # 右键菜单 _wid_display.clicked.connect(self.__model.usr_set_current_data)