Ejemplo n.º 1
0
 def setGeometry(self, _rect):
     rect = _rect
     width = self.widget().sizeHint().width()
     if self.itemRole == QFormLayout.LabelRole and self.layout.labelAlignment(
     ) & Qt.AlignRight:
         rect.setLeft(rect.right() - width)
     QWidgetItem.setGeometry(self, rect)
Ejemplo n.º 2
0
    def __init__(self):
        super(VESViewer, self).__init__()

        self.createActions()
        self.createMenus()
        win = QWidget()
        self.setCentralWidget(win)
        self.plotlayout = QHBoxLayout(self)
        self.init_m = np.append(self.init_res, self.init_thicks)
        self.datapath = self.proj_path + 'VESData/'
        # creates plot
        # self.plot = pg.PlotWidget()
        self.mw = MatplotlibWidget()
        self.subplot1 = self.mw.getFigure().add_subplot(121)
        self.subplot2 = self.mw.getFigure().add_subplot(122)
        self.mw.draw()
        self.plotlayout.addWidget(self.mw)
        # mltoolbar=self.mw.get_ToolBar()

        layout = BorderLayout()

        layout.add(self.plotlayout, BorderLayout.Center)

        self.list_w = QListWidget()
        # self.listitem.append(QListWidgetItem('Welcome to ResLayer!!!'))
        self.list_w.setFrameStyle(QFrame.Box | QFrame.Raised)
        layout.add(QWidgetItem(self.list_w), BorderLayout.West)
        win.setLayout(layout)
        # self.list_w.addItem(self.listitem[0])
        # self.list_w.itemClicked.connect(self.OnSingleClick)
        self.list_w.itemSelectionChanged.connect(self.OnSingleClick)

        self.setWindowTitle("Border Layout")

        mypen = pg.mkPen('y', width=1)
        # self.curve = self.plot.plot(x=[], y=[], pen=mypen)
        # self.plot.addItem(self.curve)

        files = os.listdir(self.datapath)
        for f in files:
            self.listitem.append(QListWidgetItem(f[:-4]))
            self.list_w.addItem(self.listitem[-1])

        self.vdf = pd.read_csv(self.datapath + files[0], header=None)
        self.plotVES()
Ejemplo n.º 3
0
    def __init__(self):
        super(ImageViewer, self).__init__()

        self.createActions()
        self.createMenus()
        self.resize(800, 600)
        win = QWidget()
        self.setCentralWidget(win)
        # creates plot
        self.plot = pg.PlotWidget(name="VES Locations")
        layout = BorderLayout()
        layout.add(QWidgetItem(self.plot), BorderLayout.Center)
        # List items
        # self.list_w =  myListWidget()
        self.list_w = QListWidget()
        self.listitem.append(QListWidgetItem('Welcome to ResLayer!!!'))
        self.list_w.setFrameStyle(QFrame.Box | QFrame.Raised)
        layout.add(QWidgetItem(self.list_w), BorderLayout.West)
        win.setLayout(layout)
        self.list_w.addItem(self.listitem[0])

        # text=self.list_w.itemClicked.connect(self.list_w.Clicked)
        self.list_w.itemClicked.connect(self.OnSingleClick)
        # print(text)

        self.setWindowTitle("Border Layout")

        mypen = pg.mkPen('y', width=1)
        self.vesdf, self.data_dfs = load_pkl(self.base_folder +
                                             'vesdf_datadf.pkl')
        self.lith_dict = load_pkl(self.base_folder + 'lith_dict.pkl')
        new_ves = load_pkl(self.base_folder + 'new_ves.pkl')
        try:
            self.boundaries = load_pkl(self.base_folder + 'boundaries.pkl')
        except:
            self.boundaries = []
        try:
            self.drilldf = load_pkl(self.base_folder + 'drill_info.pkl')

        except:
            self.drilldf = []
        try:
            self.profiles = load_pkl(self.base_folder + 'profiles.pkl')
            # print(self.profiles)
            for profile in self.profiles:
                self.listitem.append(
                    QListWidgetItem('Profile: ' +
                                    '-'.join([p for p, q in profile])))
                self.list_w.addItem(self.listitem[-1])
        except:
            self.profiles = []

        self.VES,self.E,self.N,self.Ele,self.block=self.vesdf['VES No.'].values,self.vesdf.Easting.values.astype(np.float), \
        self.vesdf.Northing.values.astype(np.float), \
        str_array2floats(self.vesdf.RL.values),self.vesdf.Block.values

        self.plot.setLabel('left', "Northing", units='deg')
        self.plot.setLabel('bottom', "Easting", units='deg')
        self.plot.showGrid(x=1, y=1, alpha=None)
        self.plot.showAxis('right')
        self.plot.showAxis('top')
        self.plot.getViewBox().setAspectLocked(True)
        # self.curve = pg.ScatterPlotItem(size=20, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))
        # spots = [{'pos': j, 'data': 1} for j in zip(self.E,self.N)]
        # self.curve.addPoints(spots)

        self.curve = self.plot.plot(
            x=self.E, y=self.N, size=10, pen=pg.mkPen(None),
            symbol='o')  #brush=pg.mkBrush(255, 100, 255, 120),pen=None,
        #drill information
        if len(self.drilldf) > 0:
            drillE, drillN, drill_labels = self.drilldf.Easting.values.astype(
                np.float), self.drilldf.Northing.values.astype(
                    np.float), self.drilldf.Location.values
            self.plot.plot(x=drillE,
                           y=drillN,
                           size=30,
                           pen=pg.mkPen(None),
                           symbol='s',
                           brush=pg.mkBrush('r'),
                           fc='r')
            self.plot_labels(self.plot, drillE, drillN, drill_labels)
        #district and block boundaries
        if len(self.boundaries) > 0:
            for b in self.boundaries:
                self.plot.plot(x=[g for g in b[0]], y=[g for g in b[1]])
        self.plot.addItem(self.curve)
        # labels=['{}-{}'.format(ves,blk) for ves,blk in zip(self.VES,self.block)]
        self.plot_labels(self.plot, self.E, self.N, self.VES, self.block)
        self.curve.scene().sigMouseMoved.connect(self.onMouseMoved)

        self.curve.scene().sigMouseClicked.connect(self.decideWhere2go)
Ejemplo n.º 4
0
 def addWidget(self, widget, position):
     self.add(QWidgetItem(widget), position)
Ejemplo n.º 5
0
 def addWidget(self, widget):
     self.addItem(QWidgetItem(widget))
Ejemplo n.º 6
0
 def __init__(self, widget, formLayout, itemRole):
     QWidgetItem.__init__(self, widget)
     self.width = -1
     self.layout = formLayout
     self.itemRole = itemRole
Ejemplo n.º 7
0
 def maximumSize(self):
     size = QWidgetItem.maximumSize(self)
     if self.width != -1:
         size.setWidth(self.width)
     return size
Ejemplo n.º 8
0
 def sizeHint(self):
     size = QWidgetItem.sizeHint(self)
     if self.width != -1:
         size.setWidth(self.width)
     return size
Ejemplo n.º 9
0
 def insertWidget(self, pos, wid):
     self.addChildWidget(wid)
     self.insertItem(pos, QWidgetItem(wid))
Ejemplo n.º 10
0
 def addWidget(self, widget, pos=None):
     self.addChildWidget(widget)
     self.addItem(QWidgetItem(widget), pos)