def save_style(self, style): current_obj = self.style_editor.textObject style = str(style) if style == current_obj.name: to_name = current_obj.To_name to_src = "default" tt_name = current_obj.Tt_name tt_src = "default" else: to_name = style to_src = current_obj.To_name tt_name = style tt_src = current_obj.Tt_name try: to = vcs.gettextorientation(to_name) except ValueError: to = vcs.createtextorientation(name=to_name, source=to_src) try: tt = vcs.gettexttable(tt_name) except ValueError: tt = vcs.createtexttable(name=tt_name, source=tt_src) get_textstyles().updated(tt_name) self.current_member.texttable = tt self.current_member.textorientation = to self.current_member = None self.sync() self.labelUpdated.emit()
def __init__(self, label, parent=None): super(TemplateLabelWidget, self).__init__(parent=parent) initmod() self.member = None layout = QtGui.QHBoxLayout() self.label = QtGui.QLabel(label) self.style_picker = QtGui.QComboBox() self.style_picker.setModel(get_textstyles()) self.style_picker.currentIndexChanged[str].connect(self.setStyle) self.edit_style = QtGui.QPushButton("Edit Style") self.edit_style.clicked.connect(self.trigger_edit) self.hide = QtGui.QPushButton(toggle_icon, u"") self.hide.setStyleSheet("QPushButton{border: none; outline: none;}") self.hide.setCheckable(True) self.hide.toggled.connect(self.toggle_vis) self.move = QtGui.QPushButton("Move Label") self.move.clicked.connect(self.trigger_move) layout.addWidget(self.label) layout.addWidget(self.style_picker) layout.addWidget(self.edit_style) layout.addWidget(self.hide) layout.addWidget(self.move) self.setLayout(layout)
def __init__(self, parent=None): super(AxisLabelEditor, self).__init__(parent=parent) initmod() self.member = None self.template = None self.hide_button = QtGui.QPushButton(toggle_icon, u"") self.hide_button.setCheckable(True) self.hide_button.clicked.connect(self.hideLabels) self.inset = False self.text_chooser = QtGui.QComboBox() self.text_chooser.setModel(get_textstyles()) self.text_chooser.currentIndexChanged[str].connect(self.setTextStyle) edit_button = QtGui.QPushButton("Edit") edit_button.clicked.connect(self.edit_text) hlayout = QtGui.QHBoxLayout() hlayout.addWidget(self.hide_button) hlayout.addWidget(self.text_chooser) hlayout.addWidget(edit_button) layout = QtGui.QVBoxLayout() layout.addLayout(hlayout) slide_layout = QtGui.QHBoxLayout() distance_label = QtGui.QLabel("Distance:") self.distance_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.distance_slider.setMinimum(0) self.distance_slider.setMaximum(100) self.distance_slider.sliderMoved.connect(self.setDistance) slide_layout.addWidget(distance_label) slide_layout.addWidget(self.distance_slider) layout.addLayout(slide_layout) self.setLayout(layout)