def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.setObjectName("ExpExcelBrowserWidget") self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) self.splitter = QtGui.QSplitter() self.mainLayout.addWidget(self.splitter, 10) self.tabWidget = QtGui.QTabWidget() self.splitter.addWidget(self.tabWidget) self.pathBrowse = ogtgui_widgets.ExpPathBrowseWidget() self.splitter.addWidget(self.pathBrowse) self.splitter.setStretchFactor(0, 4) self.splitter.setStretchFactor(1, 1) self.pathBrowse.sigOpenFile.connect(self.on_open_excel) self.on_open_excel( "/home/ogt/gstl_examples/35579/ATTS/ATTERBERG LIMITS - GSTL 2017 - WH - PAGE 4.xlsx" )
def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.debug = False self.ogtGroup = None self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) ## View Checkboxes self.topLay = xwidgets.hlayout(margin=5, spacing=5) self.mainLayout.addLayout(self.topLay) self.buttGroup = QtGui.QButtonGroup(self) self.buttGroup.setExclusive(True) self.radFixed = QtGui.QRadioButton("Show Fixed Values") self.radFixed.setChecked(True) self.topLay.addWidget(self.radFixed) self.buttGroup.addButton(self.radFixed, GroupSourceGridModel.FIXED) self.radRaw = QtGui.QRadioButton("Show Raw Values") self.topLay.addWidget(self.radRaw) self.buttGroup.addButton(self.radRaw, GroupSourceGridModel.RAW) self.topLay.addStretch(30) self.buttGroup.buttonClicked.connect(self.on_view_raw_clicked) ## Main Table self.table = QtGui.QTableView() self.mainLayout.addWidget(self.table, 0) self.model = QtGui.QStandardItemModel() self.table.setModel(self.model)
def __init__(self, parent=None, filename=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.filename = filename self.setObjectName("ExcelSheet") self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) self.tabWidget = QtGui.QTabWidget() self.mainLayout.addWidget(self.tabWidget)
def __init__(self, parent=None, sheet=None): QtGui.QWidget.__init__(self, parent) self.setObjectName("ExcelSheetWidget") self.sheet = sheet self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) self.table = QtGui.QTableWidget() self.mainLayout.addWidget(self.table) self.load_sheet()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.setObjectName("OGTSourceViewWidget") self.mainLayout = QtGui.QVBoxLayout() self.mainLayout.setSpacing(0) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout) self.tabWidget = QtGui.QTabWidget() self.mainLayout.addWidget(self.tabWidget) # Source View self.sourceView = xwidgets.LNTextEdit() self.tabWidget.addTab(self.sourceView, "Raw Text") # Grid view widget = QtGui.QWidget() gridLay = xwidgets.vlayout() widget.setLayout(gridLay) self.tabWidget.addTab(widget, "Grid View") self.splitter = QtGui.QSplitter() self.splitter.setObjectName(self.objectName() + "grid_splitter") gridLay.addWidget(self.splitter) sty = "QTableView {gridline-color: #dddddd;}" self.tableWidget = QtGui.QTableWidget() self.splitter.addWidget(self.tableWidget) self.tableWidget.setStyleSheet(sty) self.tableWidget.setSelectionMode( QtGui.QAbstractItemView.SingleSelection) self.tableWidget.itemSelectionChanged.connect(self.on_select_changed) self.tableWidget.horizontalHeader().sectionClicked.connect( self.on_row_clicked) self.errorsWidget = OGTErrorsWidget(mode=VIEW_ERR_MODE.document) self.errorsWidget.setMinimumWidth(300) self.splitter.addWidget(self.errorsWidget) self.errorsWidget.sigGotoSource.connect(self.select_cell) self.errorsWidget.sigErrorsFilter.connect(self.update_colours) G.settings.restore_splitter(self.splitter) self.splitter.splitterMoved.connect(self.on_splitter_moved) self.tabWidget.setCurrentIndex(1)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.ogtGroup = None self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) self.mainLayout.addWidget(xwidgets.XLabel("Foooo")) self.tree = QtGui.QTreeView() self.tree.setRootIsDecorated(False) self.mainLayout.addWidget(self.tree, 0) self.model = HeadersListModel() self.tree.setModel(self.model) self.tree.setColumnWidth(HeadersListModel.C.head_code, 110) self.tree.setColumnWidth(HeadersListModel.C.valid, 50) self.tree.setColumnWidth(HeadersListModel.C.unit, 50) self.tree.setColumnWidth(HeadersListModel.C.type, 50)
def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.debug = False self.ogtGroup = None self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) #== Headings self.tableHeadings = QtGui.QTableView() self.mainLayout.addWidget(self.tableHeadings, 0) self.headingsModel = GroupHeadingsModel(self) self.tableHeadings.setModel(self.headingsModel) self.tableHeadings.horizontalHeader().hide() self.tableHeadings.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.tableHeadings.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) #== Data self.tableData = QtGui.QTableView() self.mainLayout.addWidget(self.tableData, 200) self.dataModel = GroupDataModel(self) self.tableData.setModel(self.dataModel) self.tableData.horizontalHeader().hide() self.tableData.horizontalScrollBar().valueChanged.connect( self.on_table_data_h_scroll) HEADER_HEIGHT = 120 self.tableHeadings.setRowHeight(1, 60) self.tableHeadings.setFixedHeight(HEADER_HEIGHT + 30) #self.headCodeDelegeate = HeadCodeDelegate() #self.tableHeadings.setItemDelegateForRow(0, self.headCodeDelegeate) #HeadCodeWidget self.headingsModel.dataChanged.connect(self.on_header_data_changed)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.debug = False self.setMinimumWidth(300) self.mainLayout = xwidgets.vlayout() self.setLayout(self.mainLayout) #============================= ## Set up tree self.tree = QtGui.QTreeView() self.mainLayout.addWidget(self.tree) self.tree.setMinimumWidth(300) self.tree.setRootIsDecorated(False) self.tree.header().setStretchLastSection(True) self.model = GroupListModel() self.tree.setModel(self.model) """
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): QtGui.QWidget.__init__(self, parent) self.debug = False self.setObjectName("AGS4GroupsBrowser") self.proxy = QtGui.QSortFilterProxyModel() self.proxy.setSourceModel(G.ags.modelGroups) self.proxy.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive) ##=============================================== self.mainLayout = QtGui.QVBoxLayout() self.mainLayout.setSpacing(0) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout) self.splitter = QtGui.QSplitter(self) self.splitter.setObjectName(self.objectName() + "groups_splitter") self.mainLayout.addWidget(self.splitter) ############################################################################## leftWidget = QtGui.QWidget() leftLayout = xwidgets.vlayout() leftWidget.setLayout(leftLayout) self.splitter.addWidget(leftWidget) self.tabFilter = QtGui.QTabWidget() leftLayout.addWidget(self.tabFilter) ##================================ ## Filter grpFilter = xwidgets.GroupGridBox() mmm = 5 grpFilter.setContentsMargins(mmm, mmm, mmm, mmm) # grpFilter.grid.setSpacing(5) # grpFilter.setFixedWidth(150) self.tabFilter.addTab(grpFilter, "Filter") # filter combo self.buttGroupFilter = QtGui.QButtonGroup() self.buttGroupFilter.setExclusive(True) #self.comboSearchFor = QtGui.QComboBox() #grpFilter.addWidget(self.comboSearchFor) for ridx, s in enumerate(["Code", "Description", "Code + Description"]): rad = QtGui.QRadioButton() rad.setText(s) grpFilter.grid.addWidget(rad, ridx, 0, 1, 2) self.buttGroupFilter.addButton(rad, 3 if ridx == 2 else ridx) self.buttGroupFilter.button(0).setChecked(True) self.buttGroupFilter.buttonClicked.connect(self.on_filter_col) #self.comboSearchFor.addItem("Code", CG.code) #self.comboSearchFor.addItem("Description", CG.description) #self.comboSearchFor.addItem("Code + Description", CG.search) #self.comboSearchFor.setMaximumWidth(150) # clear button self.buttClear = xwidgets.ClearButton(self, callback=self.on_clear_filter) grpFilter.grid.addWidget(self.buttClear, 3, 0) ## filter text self.txtFilter = QtGui.QLineEdit() self.txtFilter.setMaximumWidth(100) grpFilter.grid.addWidget(self.txtFilter, 3, 1) self.txtFilter.textChanged.connect(self.on_txt_changed) grpFilter.grid.addWidget(QtGui.QLabel(), 4, 2) #grpFilter.layout.addStretch(3) grpFilter.grid.setColumnStretch(0, 0) grpFilter.grid.setColumnStretch(1, 10) ##================================ ## Classification Tree topLayout = QtGui.QVBoxLayout() leftLayout.addLayout(topLayout, 0) self.treeClass = QtGui.QTreeView() self.tabFilter.addTab(self.treeClass, "By classification") self.treeClass.setModel(G.ags.modelClasses) self.treeClass.setRootIsDecorated(False) self.treeClass.setExpandsOnDoubleClick(False) self.treeClass.setFixedHeight(220) self.treeClass.selectionModel().selectionChanged.connect( self.on_class_tree_selected) ##== Groups Tree self.treeGroups = QtGui.QTreeView() leftLayout.addWidget(self.treeGroups, 10) self.treeGroups.setModel(self.proxy) self.treeGroups.setUniformRowHeights(True) self.treeGroups.setRootIsDecorated(False) self.treeGroups.setAlternatingRowColors(True) self.treeGroups.header().setStretchLastSection(True) self.treeGroups.setColumnHidden(CG.search, True) self.treeGroups.setColumnWidth(CG.code, 120) self.treeGroups.setColumnWidth(CG.description, 250) self.treeGroups.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.treeGroups.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.treeGroups.setSortingEnabled(True) self.treeGroups.sortByColumn(CG.code) self.treeGroups.selectionModel().selectionChanged.connect( self.on_groups_tree_selected) self.agsGroupViewWidget = AGS4GroupViewWidget(self) self.splitter.addWidget(self.agsGroupViewWidget) self.splitter.setStretchFactor(0, 2) self.splitter.setStretchFactor(1, 5) G.settings.restore_splitter(self.splitter) self.splitter.splitterMoved.connect(self.on_splitter_moved) #self.statusBar = QtGui.QStatusBar() #self.mainLayout.addWidget(self.statusBar, 0) ############################################################################## rightWidget = QtGui.QWidget() rightLayout = xwidgets.vlayout() rightWidget.setLayout(rightLayout) self.splitter.addWidget(rightWidget) #self.agsHeadingDetailWidget = AGS4HeadingDetailWidget() #rightLayout.addWidget(self.agsHeadingDetailWidget) #self.init_setup() G.ags.sigLoaded.connect(self.on_loaded) self.txtFilter.setText("DETL")
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): QtGui.QMainWindow.__init__(self, parent) self.debug = False self.file_path = None self.ogtDoc = None self.dockProject = QtGui.QDockWidget() self.dockProject.setWindowTitle("Project") self.dockProject.setFeatures(QtGui.QDockWidget.DockWidgetMovable) self.dockProject.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.addDockWidget(Qt.LeftDockWidgetArea, self.dockProject) self.lblProjectPlace = QtGui.QLabel() self.lblProjectPlace.setText("project placeholder") self.dockProject.setWidget(self.lblProjectPlace) ## Errors self.dockGroups = QtGui.QDockWidget() self.dockGroups.setWindowTitle("Groups") self.dockGroups.setFeatures(QtGui.QDockWidget.DockWidgetMovable) self.dockGroups.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.addDockWidget(Qt.RightDockWidgetArea, self.dockGroups) self.groupsListWidget = ogtgui_groups.GroupsListWidget() self.dockGroups.setWidget(self.groupsListWidget) #self.tree.setMinimumWidth(300) #self.tree.setRootIsDecorated(False) #self.tree.header().setStretchLastSection(True) #self.setCentralWidget(self.tree) #self.model = GroupListModel() #self.tree.setModel(self.model) """ hi = self.tree.headerItem() hi.setText(CP.group_code, "Group") hi.setText(CP.group_description, "Description") hi.setText(CP.node, "Rows") hi.setTextAlignment(CP.node, Qt.AlignRight) self.tree.itemDoubleClicked.connect(self.on_tree_double_clicked) """ #self.tree.setColumnWidth(CP.node, 40) #self.tree.setColumnWidth(CP.group_code, 70) centralWidget = QtGui.QWidget() centralLay = xwidgets.vlayout() centralWidget.setLayout(centralLay) self.setCentralWidget(centralWidget) lbl = QtGui.QLabel() lbl.setText("Errors and Warnings") lbl.setStyleSheet( "font-weight: bold; padding: 3px; background-color: #eeeeee;") centralLay.addWidget(lbl) self.errorsWidget = ogtgui_widgets.OGTErrorsWidget( mode=ogtgui_widgets.VIEW_ERR_MODE.group) centralLay.addWidget(self.errorsWidget) self.errorsWidget.sigGotoSource.connect(self.on_goto_source)
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