Example #1
0
    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)
Example #2
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)
Example #3
0
    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)