def __init__(self, rows=3, cols=3, colFiled=False, rowFixed=False, parent=None): super(Table, self).__init__(rows, cols, parent) self._menu = _TableMenu(self) self._colFixed = colFiled self._rowFixed = rowFixed self._dialogs = Dialogs() self._path = None # self.setHorizontalHeader(_Header(QtCore.Qt.Horizontal, self)) self.setCurrentCell(0, 0) self.currentCellChanged.connect(self._ifAtBorderAddRow) # )
def __init__(self, imageDisplay): Tool.__init__(self, imageDisplay) self._dialogs = Dialogs() ftypes = """Portable Network Graphics (*.png) Windows bitmaps (*.bmp *.dib) JPEG files (*.jpeg *.jpg *.jpe) JPEG 2000 files (*.jp2) Portable image format (*.pbm *.pgm *.ppm) Sun rasters (*.sr *.ras) TIFF files (*.tiff *.tif)""" self.engine = { 'normal image': (self.exportCV2, ftypes), '32bit floating-point TIFF file': (self.exportFTiff, 'TIFF file (*.tiff)'), 'rendered': (self.exportRendered, ftypes), 'Numpy array': (self.exportNumpy, 'Numpy array (*.npy)'), 'Txt file': (lambda: self.exportNumpy(np.savetxt), 'Text file (*.txt)'), } pa = self.setParameterMenu() self.pExportAll = pa.addChild({ 'name': 'export all image layers', 'type': 'bool', 'value': False }) self.pEngine = pa.addChild({ 'name': 'Type', 'type': 'list', 'value': 'normal image', 'limits': self.engine.keys(), 'tip': '''normal image: export the original image array rendered: export the current display view''' }) self.pRange = self.pEngine.addChild({ 'name': 'Range', 'type': 'list', 'value': 'current', 'limits': ['0-max', 'min-max', 'current'], 'visible': True }) self.pDType = self.pEngine.addChild({ 'name': 'Bit depth', 'type': 'list', 'value': '16 bit', 'limits': ['8 bit', '16 bit'], 'visible': True }) self.pDType.sigValueChanged.connect(self._pDTypeChanged) # self.pCutNegativeValues = self.pEngine.addChild({ # 'name': 'Cut negative values', # 'type': 'bool', # 'value':False, # 'visible':True}) self.pStretchValues = self.pEngine.addChild({ 'name': 'Stretch values', 'type': 'bool', 'value': True, 'visible': True }) self.pOnlyImage = self.pEngine.addChild({ 'name': 'Only image', 'type': 'bool', 'value': False, 'tip': 'True - export only the shown image - excluding background and axes', 'visible': False }) self.pEngine.sigValueChanged.connect(self._pEngineChanged) self.pResize = pa.addChild({ 'name': 'Resize', 'type': 'bool', 'value': False }) self.pAspectRatio = self.pResize.addChild({ 'name': 'Keep Aspect Ratio', 'type': 'bool', 'value': True, 'visible': False }) self.pWidth = self.pResize.addChild({ 'name': 'Width', 'type': 'int', 'value': 0, 'visible': False }) self.pWidth.sigValueChanged.connect(self._pWidthChanged) self.pHeight = self.pResize.addChild({ 'name': 'Height', 'type': 'int', 'value': 0, 'visible': False }) self.pHeight.sigValueChanged.connect(self._pHeightChanged) self.pResize.addChild({ 'name': 'Reset', 'type': 'action', 'visible': False }).sigActivated.connect(self._pResetChanged) self.pResize.sigValueChanged.connect( lambda param, value: [ch.show(value) for ch in param.children()]) self.pPath = pa.addChild({'name': 'path', 'type': 'str', 'value': ''}) pChoosePath = self.pPath.addChild({'name': 'choose', 'type': 'action'}) pChoosePath.sigActivated.connect(self._pChoosePathChanged) self._menu.aboutToShow.connect(self._updateOutputSize) self._menu.aboutToShow.connect(self._updateDType)
from fancywidgets.pyQtBased.SnippingTool import SnippingArea from fancywidgets import media var = 0 f = "" choiceStr = "" cs = False wwo = False tt = True tf = True ts = True iconfolder = PathStr(media.__file__).dirname().join("icons", "foundation-icon-fonts-3") dialogs = Dialogs() class MainWindow(QtWidgets.QMainWindow): # rename def __init__(self, parent=None): QtWidgets.QMainWindow.__init__(self, parent) self.setWindowFlags(Qt.Widget) # allow to use mainwindow as widget self.text = _TextEdit(self) self.text.setTabStopWidth(12) self.setCentralWidget(self.text) def showToolbar(self, show): self.text.showToolbarChecked = show for t in self.findChildren(QtWidgets.QToolBar): # for t in self.toolbars: