def __init__(self, parent): QScrollArea.__init__(self, parent) self.setFrameShape(QScrollArea.NoFrame) self.setAutoFillBackground(False) self.setWidgetResizable(True) self.setMouseTracking(True) #self.verticalScrollBar().setMaximumWidth(10) widget = QWidget(self) # define custom properties self._rolloutStyle = AccordionWidget.Rounded self._dragDropMode = AccordionWidget.NoDragDrop self._scrolling = False self._scrollInitY = 0 self._scrollInitVal = 0 self._itemClass = AccordionItem self._items = {} layout = QVBoxLayout() layout.setContentsMargins(2, 2, 2, 2) layout.setSpacing(2) layout.addStretch(1) widget.setLayout(layout) self.setWidget(widget)
def __init__(self, *args, **kwargs): """Constructor""" QScrollArea.__init__(self, *args, **kwargs) # Makes widget resizable self.setWidgetResizable(True) # Creates qwidget object content = QWidget(self) self.setWidget(content) # Creates Vertical box layout lay = QVBoxLayout(content) # Creates label self.label = QLabel(content) # Sets alignment to the text self.label.setAlignment(Qt.AlignLeft | Qt.AlignTop) # Makes label multi-line self.label.setWordWrap(True) # Adds label to the layout lay.addWidget(self.label)
def __init__(self, theParent): QScrollArea.__init__(self, theParent) logger.debug("Initialising GuiDocViewDetails ...") self.mainConf = nw.CONFIG self.theParent = theParent self.theProject = theParent.theProject self.theTheme = theParent.theTheme self.currHandle = None self.refList = QLabel("") self.refList.setWordWrap(True) self.refList.setAlignment(Qt.AlignTop) self.refList.setScaledContents(True) self.refList.linkActivated.connect(self._linkClicked) self.linkStyle = "style='color: rgb({0},{1},{2})'".format( *self.theTheme.colLink) # Assemble self.outerWidget = QWidget() self.outerBox = QHBoxLayout() self.outerBox.addWidget(self.refList, 1) self.outerWidget.setLayout(self.outerBox) self.setWidget(self.outerWidget) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setWidgetResizable(True) self.setMinimumHeight(self.mainConf.pxInt(50)) logger.debug("GuiDocViewDetails initialisation complete") return
def __init__(self, gui): """ Populates the left sidebar. @param gui: GUI """ QScrollArea.__init__(self) self.gui = gui layout = QVBoxLayout() widget = QWidget() widget.setLayout(layout) self.setWidget(widget) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setWidgetResizable(True) self.setMaximumWidth(self.MaximumWidth) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.wire_widget = Wire_Widget(self.gui) layout.addWidget(self.wire_widget) layout.addSpacing(self.VerticalSpacing) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.sampling_volume_widget = SamplingVolume_Widget(self.gui) layout.addWidget(self.sampling_volume_widget)
def __init__(self, *args, **kwargs): QScrollArea.__init__(self, *args, **kwargs) # making widget resizable self.setWidgetResizable(True) # making qwidget object content = QWidget(self) self.setWidget(content) # vertical box layout lay = QVBoxLayout(content) # creating label self.label = QLabel(content) # self.setGeometry(50,200,700,300) # setting alignment to the text # self.label.setAlignment(Qt.AlignLeft | Qt.AlignTop) # making label multi-line self.label.setWordWrap(True) # adding label to the layout lay.addWidget(self.label) self.setText("Result Screen") self.label.setAlignment(Qt.AlignCenter | Qt.AlignVCenter)
def __init__(self, *args, **kwargs): QScrollArea.__init__(self, *args, **kwargs) # making widget resizable self.setWidgetResizable(True) self.setMaximumHeight(70) # making qwidget object content = QWidget() self.setWidget(content) # vertical box layout lay = QVBoxLayout(content) # creating label self.label = QLabel(content) # setting alignment to the text self.label.setAlignment(Qt.AlignLeft | Qt.AlignTop) # making label multi-line self.label.setWordWrap(True) # adding label to the layout lay.addWidget(self.label)
def __init__(self, parent = None, direction = "ltr", rtf = False): """ Creates a new QPageWidget on given parent object. parent: QWidget parent direction: "ltr" -> Left To Right "ttb" -> Top To Bottom rtf: Return to first, if its True it flips to the first page when next page requested at the last page """ # First initialize, QPageWidget is based on QScrollArea QScrollArea.__init__(self, parent) # Properties for QScrollArea self.setFrameShape(QFrame.NoFrame) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setWidgetResizable(True) # Main widget, which stores all Pages in it self.widget = QWidget(self) # Layout based on QBoxLayout which supports Vertical or Horizontal layout if direction == "ltr": self.layout = QBoxLayout(QBoxLayout.LeftToRight, self.widget) self.__scrollBar = self.horizontalScrollBar() self.__base_value = self.width else: self.layout = QBoxLayout(QBoxLayout.TopToBottom, self.widget) self.__scrollBar = self.verticalScrollBar() self.__base_value = self.height self.layout.setSpacing(0) self.layout.setMargin(0) # Return to first self.__return_to_first = rtf # TMP_PAGE, its using as last page in stack # A workaround for a QScrollArea bug self.__tmp_page = Page(QWidget(self.widget)) self.__pages = [self.__tmp_page] self.__current = 0 self.__last = 0 # Set main widget self.setWidget(self.widget) # Animation TimeLine self.__timeline = QTimeLine() self.__timeline.setUpdateInterval(2) # Updates scrollbar position when frame changed self.__timeline.frameChanged.connect(lambda x: self.__scrollBar.setValue(x)) # End of the animation self.__timeline.finished.connect(self._animateFinished) # Initialize animation self.setAnimation() self.setDuration()
def __init__(self, canvas, parent=None): QScrollArea.__init__(self, parent) self.canvas = canvas self.setWidget(canvas) self.dragging = False self.dragStartPos = QPoint() canvas.setCursor(Qt.OpenHandCursor)
def __init__(self, model, graph, *args): QScrollArea.__init__(self, *args) self.model = moose.element(model.path + "/model") self.modelRoot = self.model.path self.setLayout(QVBoxLayout(self)) self.layout().addWidget(self.getPlotListWidget()) self.setDataRoot(self.model.path) self._elementWidgetsDict = { } # element path to corresponding qlabel and fields combo
def __init__(self, control_window: Union[ControlWindow, None] = None): """Constructor. Args: control_window (Union[ControlWindow, None], optional): [description]. Defaults to None.""" QScrollArea.__init__(self, parent=control_window) self.log_layout = QVBoxLayout() self.initUI()
def __init__(self, *args, **kwargs): QScrollArea.__init__(self, *args, **kwargs) self.setWidgetResizable(True) content = QWidget(self) self.setWidget(content) lay = QVBoxLayout(content) self.label = QLabel(content) self.label.setAlignment(Qt.AlignLeft | Qt.AlignTop) self.label.setWordWrap(True) lay.addWidget(self.label)
def __init__(self, clearMouseOver, parent = None): QScrollArea.__init__(self, parent) self.clearMouseOver = clearMouseOver self.mouseOver = False self.widget = QWidget() # Just adding the layout directly doesn't work right, so wrap it in a QWidget self.setWidget(self.widget) self.setWidgetResizable(True) self.setMouseTracking(True) self.createLayout()
def __init__(self, parent): QScrollArea.__init__(self, parent=parent) # Create and configure grid layout self._grid_layout_widget = QWidget(self) self._grid_layout = QGridLayout(self._grid_layout_widget) self._grid_layout.setContentsMargins(0, 0, 0, 0) self._grid_layout.setSpacing(0) self.setGeometry(QtCore.QRect(10, 60, 800, 822))
def __init__(self, gui): """ Populates the right sidebar. @param gui: GUI """ QScrollArea.__init__(self) self.gui = gui layout = QVBoxLayout() widget = QWidget() widget.setLayout(layout) self.setWidget(widget) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setWidgetResizable(True) self.setMaximumWidth(self.MaximumWidth) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.field_widget = Field_Widget(self.gui) layout.addWidget(self.field_widget, alignment=Qt.AlignTop) layout.addSpacing(self.VerticalSpacing) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.metric_widget = Metric_Widget(self.gui) layout.addWidget(self.metric_widget, alignment=Qt.AlignTop) layout.addSpacing(self.VerticalSpacing) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.parameters_widget = Parameters_Widget(self.gui) layout.addWidget(self.parameters_widget, alignment=Qt.AlignTop) layout.addSpacing(self.VerticalSpacing) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.perspective_widget = Perspective_Widget(self.gui) layout.addWidget(self.perspective_widget, alignment=Qt.AlignTop) layout.addSpacing(self.VerticalSpacing) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.display_widget = Display_Widget(self.gui) layout.addWidget(self.display_widget, alignment=Qt.AlignTop) layout.addStretch()
def __init__(self, plotWindow, config): QScrollArea.__init__(self) self.widget = QWidget() self.clayout = QGridLayout() self.plotWindow = plotWindow self.config = config self.getGroupbox() self.setWidgetResizable(True) self.setWidget(self.widget)
def __init__(self, text='', parent=None): QScrollArea.__init__(self, parent) label = QLabel() label.setMargin(3) self.setWidget(label) self.setText(text) self.text = label.text label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) self.setFrameStyle(QFrame.NoFrame) self.setWidgetResizable(True) self.setAlignment(Qt.AlignLeft | Qt.AlignTop) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
def __init__(self): QScrollArea.__init__(self) self.vbox = QVBoxLayout() self.tab = QHBoxLayout() widget = QWidget() widget.setLayout(self.tab) self.file_path = os.path.join(get_user_settings_dir(), "lang.inp") title_label = QLabel() title_label.setWordWrap(True) title_label.setOpenExternalLinks(True) title_label.setText( latex_to_html( "<font size=5><b>Select the language you would like use gpvdm to use.</b><br><br> If a translation to your language does not exist or could be improved, then please consider joining the <a href=\"https://gpvdm.com/translation.html\">gpvdm translation project</a>. I would like gpvdm translated into as many langauges as possible to improve access to high quality solar cell simulation tools for all.</font>" )) self.vbox.addWidget(title_label) self.vbox.addWidget(widget) description = QLabel() description.setText(latex_to_html("Default language:")) self.lang_box = QComboBox() self.lang_box.addItem("auto") self.lang_box.setFixedSize(300, 25) self.tab.addWidget(description) self.tab.addWidget(self.lang_box) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.vbox.addWidget(spacer) self.setLayout(self.vbox) langs = get_languages() if langs == False: return for i in range(0, len(langs)): self.lang_box.addItem(langs[i]) token = inp_get_token_value(self.file_path, "#lang") all_items = [ self.lang_box.itemText(i) for i in range(self.lang_box.count()) ] for i in range(0, len(all_items)): if all_items[i] == token: self.lang_box.setCurrentIndex(i) self.lang_box.currentIndexChanged.connect(self.callback_edit)
def __init__( self, parent=None, engine=None, auto_freeze=False, show_subgraphs=True, manipulation_mode=QGraphVizManipulationMode.Nodes_Move_Mode, # Callbacks new_edge_beingAdded_callback=None, # A callback called when a new connection is being added (should return True or False to accept or not the edge, as well as return the edge parameters) new_edge_created_callback=None, # A callbakc called when a new connection is created between two nodes using the GUI node_selected_callback=None, # A callback called when a node is clicked edge_selected_callback=None, # A callback called when an edge is clicked node_invoked_callback=None, # A callback called when a node is double clicked edge_invoked_callback=None, # A callback called when an edge is double clicked node_removed_callback=None, # A callback called when a node is removed edge_removed_callback=None, # A callback called when an edge is removed # Custom options min_cursor_edge_dist=3, hilight_Nodes=False, hilight_Edges=False): QScrollArea.__init__(self, parent) self.core = QGraphViz_Core( parent=parent, engine=engine, auto_freeze=auto_freeze, show_subgraphs=show_subgraphs, manipulation_mode=manipulation_mode, # Callbacks new_edge_beingAdded_callback= new_edge_beingAdded_callback, # A callback called when a new connection is being added (should return True or False to accept or not the edge, as well as return the edge parameters) new_edge_created_callback= new_edge_created_callback, # A callbakc called when a new connection is created between two nodes using the GUI node_selected_callback= node_selected_callback, # A callback called when a node is clicked edge_selected_callback= edge_selected_callback, # A callback called when an edge is clicked node_invoked_callback= node_invoked_callback, # A callback called when a node is double clicked edge_invoked_callback= edge_invoked_callback, # A callback called when an edge is double clicked node_removed_callback= node_removed_callback, # A callback called when a node is removed edge_removed_callback= edge_removed_callback, # A callback called when an edge is removed # Custom options min_cursor_edge_dist=min_cursor_edge_dist, hilight_Nodes=hilight_Nodes, hilight_Edges=hilight_Edges) self.setWidgetResizable(True) self.setWidget(self.core)
def __init__(self, parent=None): QScrollArea.__init__(self, parent) palette = QPalette(self.palette()) palette.setColor(QPalette.Window, QColor(0, 0, 0, 0)) palette.setBrush(QPalette.Window, QBrush(QColor(0, 0, 0, 0))) self.setPalette(palette) self.sizehint = QSize(QScrollArea.sizeHint(self)) self.rowheight = -1 self.verticalScrollBar().valueChanged[int].connect( self.positionNearest)
def __init__(self, parent=None, status=None): QScrollArea.__init__(self, parent) self.emits = [] self.receives = self.receives = [(SELECTIONCHANGED, self.load)] self._labels = [] font = QFont() font.setBold(True) self._boldfont = font self._init() self.setWidgetResizable(True) self._status = status self._loading = False self._lastfilepath = None
def __init__(self, parent): QScrollArea.__init__(self, parent) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.keyboard = PixmapKeyboard(self) self.keyboard.setOctaves(10) self.setWidget(self.keyboard) self.setEnabled(False) self.setFixedHeight(self.keyboard.height() + self.horizontalScrollBar().height()/2 + 2) QTimer.singleShot(0, self.slot_initScrollbarValue)
def __init__(self, changed_signal, *args): QScrollArea.__init__(self, *args) self.changed_signal = changed_signal self.scale_factor = 1.0 self.image_label = QLabel() self.image_label.setBackgroundRole(QPalette.Base) self.image_label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.image_label.setScaledContents(True) self.setBackgroundRole(QPalette.Dark) self.setWidget(self.image_label)
def __init__(self, parent): QScrollArea.__init__(self, parent) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.keyboard = PixmapKeyboard(self) self.keyboard.setMode(PixmapKeyboard.HORIZONTAL) self.keyboard.setOctaves(10) self.setWidget(self.keyboard) self.setEnabled(False) self.setFixedHeight(self.keyboard.height() + self.horizontalScrollBar().height()/2 + 2) QTimer.singleShot(0, self.slot_initScrollbarValue)
def __init__(self): QScrollArea.__init__(self) self.main_widget = QWidget() hbox = QHBoxLayout() self.setStyleSheet("background-color:white;") self.label = QLabel() #self.label.setStyleSheet("background-color:white;"); self.label.setAlignment(Qt.AlignTop) self.label.setOpenExternalLinks(True) #self.label.setSizePolicy( QSizePolicy.Ignored, QSizePolicy.Ignored ); #self.label.setMaximumSize( QSize(16777215, 16777215) ) self.label.setWordWrap(True) files = os.listdir(get_html_path()) info_files = [] for i in range(0, len(files)): if files[i].startswith("info") and files[i].endswith("html"): info_files.append(files[i]) file_name = random.choice(info_files) f = open(os.path.join(get_html_path(), file_name), encoding='utf-8') data = f.readlines() f.close() text = "" for i in range(0, len(data)): line = data[i] line = bytes(line, 'utf-8').decode('utf-8', 'ignore') text = text + '\n' + data[i].rstrip() text = text.replace("get_image_file_path()", get_image_file_path()) self.label.setText(text) #self.label.setMinimumSize( QSize(0,0) ) hbox.addWidget(self.label) #image = QLabel() #pixmap = QPixmap(os.path.join(get_image_file_path(),"image.jpg")) #image.setPixmap(pixmap) #hbox.addWidget(image) self.main_widget.setLayout(hbox) self.main_widget.show() self.setWidget(self.main_widget)
def __init__(self, paths): QScrollArea.__init__(self) widget = QWidget() self.layout = QGridLayout(widget) self.paths = paths self.all_labels = [] self.nb_columns = 5 self.populate_grid(self.paths) self.setWidget(widget) self.setWidgetResizable(True) self.setMinimumWidth(1000) self.setMinimumHeight(600)
def __init__(self, text, *args, **kwargs): QScrollArea.__init__(self, *args, **kwargs) self.setWidgetResizable(True) # making qwidget object content = QWidget(self) self.setProperty("class", "scrollbar2") self.setWidget(content) # vertical box layout lay = QVBoxLayout(content) # creating label self.label = QLabel(text, parent=content) self.label.setOpenExternalLinks(True) self.label.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.LinksAccessibleByMouse) # setting alignment to the text self.label.setAlignment(Qt.AlignLeft | Qt.AlignTop) # making label multi-line self.label.setWordWrap(True) # adding label to the layout lay.addWidget(self.label)
def __init__(self, containing): QScrollArea.__init__(self) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setWidget(containing) self.setWidgetResizable(True) self.setObjectName('scrollbox') self.setStyleSheet(''' #scrollbox { border: 1px solid #ddd; background: #f5f5f5; } QScrollBar:vertical { border: none; background-color: rgb(240, 240, 240); width: 15px; margin: 0; } QScrollBar::handle:vertical { background-color: rgb(200, 200, 200); min-height: 25px; } QScrollBar::add-line:vertical { border: none; background-color: rgb(241, 241, 241); height: 0; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical { border: 1px solid grey; background-color: rgb(241, 241, 241); height: 0; subcontrol-position: top; subcontrol-origin: margin; } ''')
def __init__(self, items, parent, insertionMode=False): QScrollArea.__init__(self, parent) self._editor = parent self._items = items self._insertion_mode = insertionMode # Find all classes self._label_classes = set( [item['class'] for item in items if 'class' in item]) n_classes = len(self._label_classes) LOG.debug("Creating editor for %d item classes: %s" % (n_classes, ", ".join(list(self._label_classes)))) # Widget layout self._layout = QVBoxLayout() self._content = QWidget() self._content.setLayout(self._layout) attributes = set() for lc in self._label_classes: attributes |= set(self._editor.getLabelClassAttributes(lc)) attributes = list(attributes) attributes.sort() for attr in attributes: handler = self._editor.getHandler(attr) if handler is not None: if len(items) > 1: valid_items = [ item for item in items if attr in self._editor.getLabelClassAttributes(item['class']) ] handler.setItems(valid_items, True) else: handler.setItems(items) self._layout.addWidget(handler) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setWidgetResizable(True) self.setWidget(self._content)
def __init__(self, *args, **kwargs): QScrollArea.__init__(self, *args, **kwargs) self.View_Info = None self.View_Scale = 1 self.Add_Border = True self.Info_L_Most = 0 self.Info_T_Most = 0 self.Info_R_Most = 0 self.Info_B_Most = 0 self.draw_text = [] # {'text':#,'font':#,'rect':#} self.draw_marker = [] # {'rect':#} self.draw_Img = [] # {'rect':#} self.draw_rec = [] # {'rect':#} #self.Temp = QLabel(self) self.PreView_Img = None self.View = QLabel(self) self.View.setAlignment(Qt.AlignCenter) self.View.setScaledContents(True) # Preview自适应 #self.View.setMaximumWidth(700) self.setWidget(self.View) self.setAlignment(Qt.AlignCenter) self.View.setStyleSheet("border:2px solid red")
def __init__(self): QScrollArea.__init__(self) self.zoomMode = ZOOM_FACTOR self.zoomFactor = 1 self.moving = None imgWidget = QLabel() imgWidget.setMouseTracking(True) imgWidget.setAlignment(Qt.AlignCenter) self.setWidget(imgWidget) self.setAlignment(Qt.AlignCenter) self.setMouseTracking(True) self.setFrameShape(self.NoFrame) self.setWidgetResizable(True) pal = QPalette() pal.setColor(QPalette.Window, Qt.black) self.setPalette(pal) self.leftZone = False self.topZone = False
def __init__(self, model, parent=None): QScrollArea.__init__(self, parent) self.model = model self.expanding = {i: False for i in self.model.getIds()} self.itemDict = dict() self.setFixedWidth(self.fixedWidth) self.setMinimumHeight(self.minHeight) self.updateGeometry() layout = QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.setAlignment(Qt.AlignTop | Qt.AlignLeft) layout.setSizeConstraint(QLayout.SetMinAndMaxSize) rootId = 0 self.__construct(layout, rootId, 0) self.contentSpace = QWidget() self.contentSpace.setLayout(layout) ##layout added here self.setWidget(self.contentSpace)
def __init__(self, items, parent, insertionMode=False): QScrollArea.__init__(self, parent) self._editor = parent self._items = items self._insertion_mode = insertionMode # Find all classes self._label_classes = set([item['class'] for item in items if 'class' in item]) n_classes = len(self._label_classes) LOG.debug("Creating editor for %d item classes: %s" % (n_classes, ", ".join(list(self._label_classes)))) # Widget layout self._layout = QVBoxLayout() self._content = QWidget() self._content.setLayout(self._layout) attributes = set() for lc in self._label_classes: attributes |= set(self._editor.getLabelClassAttributes(lc)) attributes = list(attributes) attributes.sort() for attr in attributes: handler = self._editor.getHandler(attr) if handler is not None: if len(items) > 1: valid_items = [item for item in items if attr in self._editor.getLabelClassAttributes(item['class'])] handler.setItems(valid_items, True) else: handler.setItems(items) self._layout.addWidget(handler) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setWidgetResizable(True) self.setWidget(self._content)
def __init__(self, *args, **kwargs): QScrollArea.__init__(self, *args, **kwargs) self.Scale_Factor = 1 self.horizontalScrollBar().valueChanged.connect(self.Send_Signal) self.verticalScrollBar().valueChanged.connect(self.Send_Signal)
def __init__(self, theParent): QScrollArea.__init__(self, theParent) logger.debug("Initialising GuiOutlineDetails ...") self.mainConf = novelwriter.CONFIG self.theParent = theParent self.theProject = theParent.theProject self.theTheme = theParent.theTheme self.theIndex = theParent.theIndex self.optState = theParent.theProject.optState # Sizes minTitle = 30 * self.theTheme.textNWidth maxTitle = 40 * self.theTheme.textNWidth wCount = self.theTheme.getTextWidth("999,999") hSpace = int(self.mainConf.pxInt(10)) vSpace = int(self.mainConf.pxInt(4)) # Details Area self.titleLabel = QLabel("<b>%s</b>" % self.tr("Title")) self.fileLabel = QLabel("<b>%s</b>" % self.tr("Document")) self.itemLabel = QLabel("<b>%s</b>" % self.tr("Status")) self.titleValue = QLabel("") self.fileValue = QLabel("") self.itemValue = QLabel("") self.titleValue.setMinimumWidth(minTitle) self.titleValue.setMaximumWidth(maxTitle) self.fileValue.setMinimumWidth(minTitle) self.fileValue.setMaximumWidth(maxTitle) self.itemValue.setMinimumWidth(minTitle) self.itemValue.setMaximumWidth(maxTitle) # Stats Area self.cCLabel = QLabel("<b>%s</b>" % self.tr("Characters")) self.wCLabel = QLabel("<b>%s</b>" % self.tr("Words")) self.pCLabel = QLabel("<b>%s</b>" % self.tr("Paragraphs")) self.cCValue = QLabel("") self.wCValue = QLabel("") self.pCValue = QLabel("") self.cCValue.setMinimumWidth(wCount) self.wCValue.setMinimumWidth(wCount) self.pCValue.setMinimumWidth(wCount) self.cCValue.setAlignment(Qt.AlignRight) self.wCValue.setAlignment(Qt.AlignRight) self.pCValue.setAlignment(Qt.AlignRight) # Synopsis self.synopLabel = QLabel("<b>%s</b>" % self.tr("Synopsis")) self.synopValue = QLabel("") self.synopLWrap = QHBoxLayout() self.synopValue.setWordWrap(True) self.synopValue.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.synopLWrap.addWidget(self.synopValue, 1) # Tags self.povKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.POV_KEY])) self.focKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.FOCUS_KEY])) self.chrKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.CHAR_KEY])) self.pltKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.PLOT_KEY])) self.timKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.TIME_KEY])) self.wldKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.WORLD_KEY])) self.objKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.OBJECT_KEY])) self.entKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.ENTITY_KEY])) self.cstKeyLabel = QLabel( "<b>%s</b>" % trConst(nwLabels.KEY_NAME[nwKeyWords.CUSTOM_KEY])) self.povKeyLWrap = QHBoxLayout() self.focKeyLWrap = QHBoxLayout() self.chrKeyLWrap = QHBoxLayout() self.pltKeyLWrap = QHBoxLayout() self.timKeyLWrap = QHBoxLayout() self.wldKeyLWrap = QHBoxLayout() self.objKeyLWrap = QHBoxLayout() self.entKeyLWrap = QHBoxLayout() self.cstKeyLWrap = QHBoxLayout() self.povKeyValue = QLabel("") self.focKeyValue = QLabel("") self.chrKeyValue = QLabel("") self.pltKeyValue = QLabel("") self.timKeyValue = QLabel("") self.wldKeyValue = QLabel("") self.objKeyValue = QLabel("") self.entKeyValue = QLabel("") self.cstKeyValue = QLabel("") self.povKeyValue.setWordWrap(True) self.focKeyValue.setWordWrap(True) self.chrKeyValue.setWordWrap(True) self.pltKeyValue.setWordWrap(True) self.timKeyValue.setWordWrap(True) self.wldKeyValue.setWordWrap(True) self.objKeyValue.setWordWrap(True) self.entKeyValue.setWordWrap(True) self.cstKeyValue.setWordWrap(True) self.povKeyValue.linkActivated.connect(self._tagClicked) self.focKeyValue.linkActivated.connect(self._tagClicked) self.chrKeyValue.linkActivated.connect(self._tagClicked) self.pltKeyValue.linkActivated.connect(self._tagClicked) self.timKeyValue.linkActivated.connect(self._tagClicked) self.wldKeyValue.linkActivated.connect(self._tagClicked) self.objKeyValue.linkActivated.connect(self._tagClicked) self.entKeyValue.linkActivated.connect(self._tagClicked) self.cstKeyValue.linkActivated.connect(self._tagClicked) self.povKeyLWrap.addWidget(self.povKeyValue, 1) self.focKeyLWrap.addWidget(self.focKeyValue, 1) self.chrKeyLWrap.addWidget(self.chrKeyValue, 1) self.pltKeyLWrap.addWidget(self.pltKeyValue, 1) self.timKeyLWrap.addWidget(self.timKeyValue, 1) self.wldKeyLWrap.addWidget(self.wldKeyValue, 1) self.objKeyLWrap.addWidget(self.objKeyValue, 1) self.entKeyLWrap.addWidget(self.entKeyValue, 1) self.cstKeyLWrap.addWidget(self.cstKeyValue, 1) # Selected Item Details self.mainGroup = QGroupBox(self.tr("Title Details"), self) self.mainForm = QGridLayout() self.mainGroup.setLayout(self.mainForm) self.mainForm.addWidget(self.titleLabel, 0, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.titleValue, 0, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.cCLabel, 0, 2, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.cCValue, 0, 3, 1, 1, Qt.AlignTop | Qt.AlignRight) self.mainForm.addWidget(self.fileLabel, 1, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.fileValue, 1, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.wCLabel, 1, 2, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.wCValue, 1, 3, 1, 1, Qt.AlignTop | Qt.AlignRight) self.mainForm.addWidget(self.itemLabel, 2, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.itemValue, 2, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.pCLabel, 2, 2, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addWidget(self.pCValue, 2, 3, 1, 1, Qt.AlignTop | Qt.AlignRight) self.mainForm.addWidget(self.synopLabel, 3, 0, 1, 4, Qt.AlignTop | Qt.AlignLeft) self.mainForm.addLayout(self.synopLWrap, 4, 0, 1, 4, Qt.AlignTop | Qt.AlignLeft) self.mainForm.setColumnStretch(1, 1) self.mainForm.setRowStretch(4, 1) self.mainForm.setHorizontalSpacing(hSpace) self.mainForm.setVerticalSpacing(vSpace) # Selected Item Tags self.tagsGroup = QGroupBox(self.tr("Reference Tags"), self) self.tagsForm = QGridLayout() self.tagsGroup.setLayout(self.tagsForm) self.tagsForm.addWidget(self.povKeyLabel, 0, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.povKeyLWrap, 0, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.focKeyLabel, 1, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.focKeyLWrap, 1, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.chrKeyLabel, 2, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.chrKeyLWrap, 2, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.pltKeyLabel, 3, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.pltKeyLWrap, 3, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.timKeyLabel, 4, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.timKeyLWrap, 4, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.wldKeyLabel, 5, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.wldKeyLWrap, 5, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.objKeyLabel, 6, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.objKeyLWrap, 6, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.entKeyLabel, 7, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.entKeyLWrap, 7, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addWidget(self.cstKeyLabel, 8, 0, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.addLayout(self.cstKeyLWrap, 8, 1, 1, 1, Qt.AlignTop | Qt.AlignLeft) self.tagsForm.setColumnStretch(1, 1) self.tagsForm.setRowStretch(8, 1) self.tagsForm.setHorizontalSpacing(hSpace) self.tagsForm.setVerticalSpacing(vSpace) # Assemble self.outerWidget = QWidget() self.outerBox = QHBoxLayout() self.outerBox.addWidget(self.mainGroup, 0) self.outerBox.addWidget(self.tagsGroup, 1) self.outerWidget.setLayout(self.outerBox) self.setWidget(self.outerWidget) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setWidgetResizable(True) self.initDetails() logger.debug("GuiOutlineDetails initialisation complete") return
def __init__(self, parent=None): QScrollArea.__init__(self, parent)