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)
Example #2
0
    def __init__(self, parent=None, mode=None):
        QtGui.QWidget.__init__(self, parent)

        self.group_code = None

        self.mainLayout = QtGui.QVBoxLayout()
        self.mainLayout.setSpacing(0)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.mainLayout)

        self.toolbar = xwidgets.hlayout()
        self.mainLayout.addLayout(self.toolbar, 0)

        self.icoLabel = xwidgets.IconLabel(self, ico=Ico.AgsGroup)
        self.icoLabel.setStyleSheet("background-color: white; color: #444444;")
        self.toolbar.addWidget(self.icoLabel)

        self.lblGroupCode = QtGui.QLabel(" ")
        self.lblGroupCode.setStyleSheet(
            "background-color: white; color: %s; font-weight: bold; font-family: monospace; padding: 3px;"
            % AGS4_COLORS.group)
        self.toolbar.addWidget(self.lblGroupCode, 1)
        self.lblGroupCode.setFixedWidth(50)

        self.lblDescription = QtGui.QLabel(" ")
        self.lblDescription.setStyleSheet(
            "background-color: white; color: #444444;")
        self.toolbar.addWidget(self.lblDescription, 3)

        self.mainLayout.addSpacing(10)

        ## Headings Table
        self.agsHeadingsTable = AGS4HeadingsTable(self)
        self.mainLayout.addWidget(self.agsHeadingsTable, 10)

        ##== Bottom Splitter
        self.splitBott = QtGui.QSplitter()
        self.splitBott.setObjectName("ags_group_view_notes_picklist")
        self.mainLayout.addWidget(self.splitBott)

        ## Notes
        self.agsGroupNotesWidget = AGS4GroupNotesWidget(self)
        self.agsGroupNotesWidget.setFixedHeight(200)
        self.splitBott.addWidget(self.agsGroupNotesWidget)

        ## Abbrs Picklist
        self.agsAbbrevsWidget = AGS4AbbrevsWidget()
        self.splitBott.addWidget(self.agsAbbrevsWidget)

        ## setup splitter
        self.splitBott.setStretchFactor(0, 1)
        self.splitBott.setStretchFactor(1, 1)
        G.settings.restore_splitter(self.splitBott)
        self.splitBott.splitterMoved.connect(self.on_splitter_bott_moved)

        self.agsHeadingsTable.sigHeadingSelected.connect(
            self.on_heading_selection_changed)
        self.agsGroupNotesWidget.sigWordClicked.connect(self.on_word_clicked)
Example #3
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.mainLayout = QtGui.QVBoxLayout()
        self.mainLayout.setSpacing(0)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.mainLayout)

        self.toolbar = xwidgets.hlayout()
        self.mainLayout.addLayout(self.toolbar, 0)

        self.icoLabel = xwidgets.IconLabel(self, ico=Ico.AgsGroup)
        self.icoLabel.setStyleSheet("background-color: white; color: #444444;")
        self.toolbar.addWidget(self.icoLabel, 0)

        self.lblAbbrCode = QtGui.QLabel(" ")
        self.lblAbbrCode.setStyleSheet(
            "background-color: white; color: %s; font-weight: bold; font-family: monospace; padding: 3px;"
            % AGS4_COLORS.group)
        self.toolbar.addWidget(self.lblAbbrCode, 20)

        ##=== Tree
        self.tree = QtGui.QTreeView()
        self.mainLayout.addWidget(self.tree)
        self.tree.setUniformRowHeights(True)
        self.tree.setRootIsDecorated(False)
        self.tree.setAlternatingRowColors(True)
        self.tree.setSortingEnabled(False)

        self.model = AbbrevItemsModel()
        self.tree.setModel(self.model)

        CA = AbbrevItemsModel.CA
        self.tree.setColumnWidth(CA.code, 100)
        self.tree.setColumnWidth(CA.description, 50)

        self.tree.header().setStretchLastSection(True)

        # TODO fix sort to ags
        self.tree.setSortingEnabled(True)

        self.set_heading(None)
    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, 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()
Example #6
0
    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