def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.setObjectName("ExcelBrowserWidget") self.mainLayout = QtGui.QVBoxLayout() self.mainLayout.setSpacing(0) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout) self.toolbar = QtGui.QToolBar() self.mainLayout.addWidget(self.toolbar, 0) tbg = xwidgets.ToolBarGroup(title="Selected Dir") self.toolbar.addWidget(tbg) buttSel = xwidgets.XToolButton(text="Select") self.toolbar.addWidget(buttSel) self.txtPath = QtGui.QLineEdit() tbg.addWidget(self.txtPath) if G.args.dev: self.txtPath.setText("/home/ogt/gstl_examples/35579") self.tree = QtGui.QTreeView() self.mainLayout.addWidget(self.tree, 30) self.dirModel = QtGui.QFileSystemModel() self.dirModel.setRootPath(self.txtPath.text()) self.dirModel.setNameFilters(["*.xlsx"]) self.tree.setModel(self.dirModel) self.tree.setRootIndex(self.dirModel.index(self.txtPath.text())) #print self.txtPath.text() if G.args.dev: ed = os.path.join(str(self.txtPath.text()), "ATTS") self.tree.expand(self.dirModel.index(ed)) self.tree.setColumnWidth(0, 400) self.tree.doubleClicked.connect(self.on_tree_double_clicked)
def __init__(self, parent=None, ogtDoc=None): QtGui.QWidget.__init__(self, parent) self.ogtDoc = ogtDoc self.ogtHeading = None self.debug = False self.setAutoFillBackground(True) self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) ## So splits up tthe header into parts.. #self.headerWidget = QtGui.QWidget() self.headerCodeLay = xwidgets.hlayout() #self.headerWidget.setLayout(self.headerGridLay) self.mainLayout.addLayout(self.headerCodeLay) self.lblHeadCode = xwidgets.XLabel("-", bold=True) self.headerCodeLay.addWidget(self.lblHeadCode, 10) #self.buttGroup = xwidgets.XToolButton(self, text="group") #self.headerGridLay.addWidget(self.buttGroup) self.buttHeadCode = xwidgets.XToolButton(self, ico=Ico.BulletDown, bold=True, popup=True, menu=True) self.buttHeadCode.setToolButtonStyle(Qt.ToolButtonIconOnly) self.headerCodeLay.addWidget(self.buttHeadCode, 0) self.buttHeadCode.menu().addAction("Open Group TODO") self.buttHeadCode.menu().addAction("Select another heading TODO") #sp = self.buttHeadCode.sizePolicy() #sp.setHorizontalPolicy(QtGui.QSizePolicy.Expanding) #self.buttHeadCode.setSizePolicy(sp) """
def __init__(self, parent=None, mode=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.mode = mode if self.mode == None: freak_out() self.mainLayout = QtGui.QVBoxLayout() self.mainLayout.setSpacing(0) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout) self.toolBar = QtGui.QToolBar() self.mainLayout.addWidget(self.toolBar) self.buttGroupFilters = QtGui.QButtonGroup(self) self.buttGroupFilters.setExclusive(False) self.buttWarnings = xwidgets.XToolButton(text="Show Warnings", checkable=True, checked=True) self.buttGroupFilters.addButton(self.buttWarnings) self.buttErrors = xwidgets.XToolButton(text="Show Errors", checkable=True, checked=True) self.buttGroupFilters.addButton(self.buttErrors) self.buttGroupFilters.buttonClicked.connect(self.on_update_filter) self.toolBar.addWidget(self.buttWarnings) self.toolBar.addWidget(self.buttErrors) #============================= ## Set up tree self.tree = QtGui.QTreeView() self.mainLayout.addWidget(self.tree, 30) self.model = ErrorsListModel(mode=self.mode) self.tree.setModel(self.model) self.tree.setRootIsDecorated(False) self.tree.header().setStretchLastSection(True) #self.tree.setSortingEnabled(True) """ hi = self.tree.headerItem() hi.setText(C_ERR.err, "Type") hi.setText(C_ERR.lidx, "Line") hi.setText(C_ERR.cidx, "Col") hi.setText(C_ERR.rule, "Rule") hi.setText(C_ERR.highlight, "Rule") hi.setText(C_ERR.descr, "Description") hi.setText(C_ERR.search, "search") """ self.tree.setColumnHidden(C_ERR.err, True) self.tree.setColumnHidden(C_ERR.search, True) self.tree.setColumnWidth(C_ERR.lidx, 30) self.tree.setColumnWidth(C_ERR.cidx, 30) self.tree.setColumnWidth(C_ERR.rule, 50) self.tree.setColumnWidth(C_ERR.highlight, 8)
def __init__(self, parent=None, ogtGroup=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.ogtGroup = None self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) ## titles and toolbar at top ========= m = 3 topLay = xwidgets.hlayout(margin=m) self.mainLayout.addLayout(topLay, 0) # View Mode self.tbgView = xwidgets.ToolBarGroup( title="View", is_group=True, toggle_icons=True, toggle_callback=self.on_view_change) topLay.addWidget(self.tbgView) self.tbgView.addButton(text="Data", idx=0, checkable=True) self.tbgView.addButton(text="Source", idx=1, checkable=True, checked=True) # description sty = "background-color: #333333; color: #dddddd; padding: 2px;" self.lblGroupDescription = QtGui.QLabel() self.lblGroupDescription.setStyleSheet(sty + "") topLay.addWidget(self.lblGroupDescription, 100) # The AGS group data self.buttGroupCode = xwidgets.XToolButton(text="-", ico=Ico.Ags4, bold=True, width=80, tooltip="View AGS data Dict") #self.buttGroupCode.setStyleSheet( "font-weight: bold;") topLay.addWidget(self.buttGroupCode, 0) self.buttGroupCode.clicked.connect(self.on_butt_group_code) # mid splitter with stack widget self.splitter = QtGui.QSplitter() self.mainLayout.addWidget(self.splitter) #self.stackWidget = QtGui.QStackedWidget() #self.splitter.addWidget(self.stackWidget) # Left LAyout if True: self.leftWidget = QtGui.QWidget() self.leftLay = xwidgets.vlayout() self.leftWidget.setLayout(self.leftLay) self.splitter.addWidget(self.leftWidget) self.groupDataTableWidget = GroupDataTableWidget(self) self.leftLay.addWidget(self.groupDataTableWidget) self.groupSourceTableWidget = GroupSourceGridTableWidget(self) self.leftLay.addWidget(self.groupSourceTableWidget) # Right LAyout self.rightWidget = QtGui.QWidget() self.rightLay = xwidgets.vlayout() self.rightWidget.setLayout(self.rightLay) self.splitter.addWidget(self.rightWidget) self.errorsWidget = ogtgui_widgets.OGTErrorsWidget( mode=ogtgui_widgets.VIEW_ERR_MODE.group) self.rightLay.addWidget(self.errorsWidget, 1) self.headersListWidget = HeadersListWidget() self.headersListWidget.setMinimumWidth(300) self.rightLay.addWidget(self.headersListWidget, 1) self.splitter.setStretchFactor(0, 10) self.splitter.setStretchFactor(1, 4) #self.splitter.setStretchFactor(0, 10) #self.splitter.setStretchFactor(1, 0) if ogtGroup: self.set_group(ogtGroup) self.groupSourceTableWidget.model.layoutChanged.connect( self.on_data_changed) self.groupDataTableWidget.headingsModel.layoutChanged.connect( self.on_data_changed) self.groupDataTableWidget.dataModel.layoutChanged.connect( self.on_data_changed) self.on_view_change(self.tbgView.get_id()) #self.groupDataTableWidget.headingsModel.dataChanged.connect(self.on_headings_data_changed) self.on_data_changed()
def __init__(self, parent=None, ogtDoc=None): QtGui.QWidget.__init__(self, parent) self.ogtDoc = ogtDoc self.ogtHeading = None self.debug = False self.mainLayout = QtGui.QGridLayout() self.mainLayout.setSpacing(0) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout) row = 0 ## So splits up tthe header into parts.. #self.headerWidget = QtGui.QWidget() self.headerGridLay = QtGui.QHBoxLayout() #self.headerWidget.setLayout(self.headerGridLay) self.mainLayout.addLayout(self.headerGridLay, row, 0, 1, 3) self.lblHeadCode = xwidgets.XLabel("-", bold=True) self.headerGridLay.addWidget(self.lblHeadCode, 10) #self.buttGroup = xwidgets.XToolButton(self, text="group") #self.headerGridLay.addWidget(self.buttGroup) self.buttHeadCode = xwidgets.XToolButton(self, ico=Ico.BulletDown, bold=True, popup=True, menu=True) self.buttHeadCode.setToolButtonStyle(Qt.ToolButtonIconOnly) self.headerGridLay.addWidget(self.buttHeadCode, 0) self.buttHeadCode.menu().addAction("Open Group TODO") self.buttHeadCode.menu().addAction("Select another heading TODO") #sp = self.buttHeadCode.sizePolicy() #sp.setHorizontalPolicy(QtGui.QSizePolicy.Expanding) #self.buttHeadCode.setSizePolicy(sp) sty = "background-color: #dddddd; color: black; padding: 3px; font-size: 8pt;" # description row += 1 self.lblHeadDescription = QtGui.QLabel() self.lblHeadDescription.setStyleSheet(sty) self.lblHeadDescription.setFixedHeight(60) self.lblHeadDescription.setWordWrap(True) self.lblHeadDescription.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.mainLayout.addWidget(self.lblHeadDescription, row, 0, 1, 3) # unit row += 1 lbl = xwidgets.XLabel("Unit:", align=Qt.AlignRight, style=sty) self.mainLayout.addWidget(lbl, row, 0) self.lblUnit = xwidgets.XLabel("-", bold=True, style=sty + "color: #000099;") self.mainLayout.addWidget(self.lblUnit, row, 1, 1, 2) # Type row += 1 lbl = xwidgets.XLabel("Type:", align=Qt.AlignRight, style=sty) self.mainLayout.addWidget(lbl, row, 0) self.lblType = xwidgets.XLabel("-", bold=True, style=sty + "color: #000099;") self.mainLayout.addWidget(self.lblType, row, 1) self.buttLink = QtGui.QToolButton() #self.buttLink.setAutoRaise(True) self.buttLink.setText("Goto") self.mainLayout.addWidget(self.buttLink, row, 2) self.buttLink.setVisible(False) self.buttLink.clicked.connect(self.on_goto) self.mainLayout.setColumnStretch(0, 1) self.mainLayout.setColumnStretch(1, 5)
def __init__(self, parent=None, empty=False): QtGui.QWidget.__init__(self, parent) self.debug = False self.ogtDoc = None if empty: self.ogtDoc = ogt_doc.OGTDocument() self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) ##====== Top Bar === self.topLay = xwidgets.hlayout() self.mainLayout.addLayout(self.topLay) ## Header Label self.lblHeader = QtGui.QLabel() self.lblHeader.setStyleSheet( "background-color: #444444; color: #dddddd; font-size: 14pt; padding: 3px 5px;" ) self.topLay.addWidget(self.lblHeader, 100) ## Add button self.buttActAdd = xwidgets.XToolButton(text="Add..", ico=Ico.Add, menu=True, popup=True) self.topLay.addWidget(self.buttActAdd) ## Import button self.buttImport = xwidgets.XToolButton(text="Import", ico=Ico.Import, menu=True, popup=True) self.topLay.addWidget(self.buttImport) self.buttImport.menu().addAction("Add default PROJ, UNIT, etc groups", self.on_add_default_groups) ## Export button self.buttExport = xwidgets.XToolButton(text="Export", ico=Ico.Export, menu=True, popup=True) self.topLay.addWidget(self.buttExport) for a in FORMATS: self.buttExport.menu().addAction("%s - TODO" % a) ## Reload button self.buttReload = xwidgets.XToolButton(text="Reload", ico=Ico.Refresh, popup=True, callback=self.on_reload) self.topLay.addWidget(self.buttReload) self.mainLayout.addSpacing(5) ##========= Content =============== ## tabar + Stack self.tabBar = QtGui.QTabBar() f = self.tabBar.font() f.setBold(True) self.tabBar.setFont(f) self.mainLayout.addWidget(self.tabBar) self.stackWidget = XStackedWidget() #QtGui.QStackedWidget() self.mainLayout.addWidget(self.stackWidget) ## Summary Tab self.tabBar.addTab(Ico.icon(Ico.Summary), "Summary") self.ogtProjSummaryWidget = OGTProjectSummaryWidget() self.stackWidget.addWidget(self.ogtProjSummaryWidget, "Project Summary") self.ogtProjSummaryWidget.sigGoto.connect(self.on_goto) self.ogtProjSummaryWidget.sigGotoSource.connect(self.on_goto_source) ## Groups Tab self.tabBar.addTab(Ico.icon(Ico.Groups), "Groups") self.ogtDocWidget = ogtgui_doc.OGTDocumentWidget() nidx = self.stackWidget.addWidget(self.ogtDocWidget, "Groups") chk = QtGui.QCheckBox() chk.setText("Show Data Count") self.stackWidget.addHeaderWidget(nidx, chk) ## Schedule Tab self.tabBar.addTab(Ico.icon(Ico.Schedule), "Schedule") self.ogtScheduleWidget = ogtgui_widgets.OGTScheduleWidget() self.stackWidget.addWidget(self.ogtScheduleWidget, "Schedule") ## Source tab self.tabBar.addTab(Ico.icon(Ico.Source), "Source") self.ogtSourceViewWidget = ogtgui_widgets.OGTSourceViewWidget() self.stackWidget.addWidget(self.ogtSourceViewWidget, "Sources") if False: self.tabBar.addTab(Ico.icon(Ico.Map), "Map") self.mapOverviewWidget = map_widgets.MapOverviewWidget() self.stackWidget.addWidget(self.mapOverviewWidget) self.tabBar.currentChanged.connect(self.on_tab_changed) if G.args.dev: self.tabBar.setCurrentIndex(1) pass