Set cut setting for printer. 
        
        Args:
            cut: The type of cut setting we want. Choices are 'full', 'half', 'chain', and 'special'.
        Returns:
            None
        Raises:
            RuntimeError: Invalid cut type.
173625
def cut_setting(self, cut):
        '''
        '''
        
        cut_settings = {'full' : 0b00000001,
                        'half' : 0b00000010,
                        'chain': 0b00000100,
                        'special': 0b00001000
                        }
        if cut in cut_settings:
            self.send(chr(27)+'iC'+chr(cut_settings[cut]))
        else:
            raise RuntimeError('Invalid cut type.')
141123
void setSplitVariables(List<Point2D_I32> contour, Element<Corner> e0, Element<Corner> e1) {

		int distance0 = CircularIndex.distanceP(e0.object.index, e1.object.index, contour.size());

		int index0 = CircularIndex.plusPOffset(e0.object.index,minimumSideLength,contour.size());
		int index1 = CircularIndex.minusPOffset(e1.object.index,minimumSideLength,contour.size());

		splitter.selectSplitPoint(contour, index0, index1, resultsA);

		// if convex only perform the split if it would result in a convex polygon
		if( convex ) {
			Point2D_I32 a = contour.get(e0.object.index);
			Point2D_I32 b = contour.get(resultsA.index);
			Point2D_I32 c = contour.get(next(e0).object.index);

			if (UtilPolygons2D_I32.isPositiveZ(a, b, c)) {
				e0.object.splitable = false;
				return;
			}
		}

		// see if this would result in a side that's too small
		int dist0 = CircularIndex.distanceP(e0.object.index,resultsA.index, contour.size());
		if( dist0 < minimumSideLength || (contour.size()-dist0) < minimumSideLength ) {
			throw new RuntimeException("Should be impossible");
		}

		// this function is only called if splitable is set to true so no need to set it again
		e0.object.splitLocation = resultsA.index;
		e0.object.splitError0 = computeSideError(contour, e0.object.index, resultsA.index);
		e0.object.splitError1 = computeSideError(contour, resultsA.index, e1.object.index);

		if( e0.object.splitLocation >= contour.size() )
			throw new RuntimeException("Egads");
	}
484070
def apply_cut(self, cut):
        
        return Subsystem(self.network, self.state, self.node_indices,
                         cut=cut, mice_cache=self._mice_cache)
390647
def setting(self):
        
        prog_type = self.__program.program_type
        return self._setting / self.SETTING_DIVIDES[prog_type]
470862
def option(self, option):
        
        if self.__current_section is None:
            raise RuntimeError('No section set in option-getting')
        return self.__config[self.__current_section][option]
1282579
def set_editor(self, editor):
        
        try:
            self._editor.cursorPositionChanged.disconnect(self.sync)
        except (AttributeError, TypeError, RuntimeError, ReferenceError):
            pass
        try:
            self._outline_mode.document_changed.disconnect(
                self._on_changed)
        except (AttributeError, TypeError, RuntimeError, ReferenceError):
            pass
        try:
            self._folding_panel.trigger_state_changed.disconnect(
                self._on_block_state_changed)
        except (AttributeError, TypeError, RuntimeError, ReferenceError):
            pass
        if editor:
            self._editor = weakref.proxy(editor)
        else:
            self._editor = None

        if editor is not None:
            editor.cursorPositionChanged.connect(self.sync)
            try:
                self._folding_panel = weakref.proxy(
                    editor.panels.get(FoldingPanel))
            except KeyError:
                pass
            else:
                self._folding_panel.trigger_state_changed.connect(
                    self._on_block_state_changed)
            try:
                analyser = editor.modes.get(OutlineMode)
            except KeyError:
                self._outline_mode = None
            else:
                self._outline_mode = weakref.proxy(analyser)
                analyser.document_changed.connect(self._on_changed)
        self._on_changed()
1110160
def set(self, value, start=None, stop=None):
		""""""
		_check_start_stop(start, stop)
		# start_index, stop_index will denote the sections we are replacing
		start_index = self._bisect_left(start)
		if start is not None:  # start_index == 0
			prev_value = self._values[start_index - 1]
			if prev_value == value:
				# We're setting a range where the left range has the same
				# value, so create one big range
				start_index -= 1
				start = self._keys[start_index]
		if stop is None:
			new_keys = [start]
			new_values = [value]
			stop_index = len(self._keys)
		else:
			stop_index = self._bisect_right(stop)
			stop_value = self._values[stop_index - 1]
			stop_key = self._keys[stop_index - 1]
			if stop_key == stop and stop_value == value:
				new_keys = [start]
				new_values = [value]
			else:
				new_keys = [start, stop]
				new_values = [value, stop_value]
		self._keys[start_index:stop_index] = new_keys
		self._values[start_index:stop_index] = new_values
1070405
def _onShortcutCutLine(self):
        
        lines = self.lines[self._selectedLinesSlice()]

        self._onShortcutCopyLine()
        self._onShortcutDeleteLine()
807001
def _onShortcutPrint(self):
        
        dialog = QPrintDialog(self)
        if dialog.exec_() == QDialog.Accepted:
            printer = dialog.printer()
            self.print_(printer)
446212
def setValue(self, value):
        
        if value >= self.minimum() and value <= self.maximum():
            self._lineEdit.setText(str(value))
        elif value < self.minimum():
            self._lineEdit.setText(str(self.minimum()))
        elif value > self.maximum():
            self._lineEdit.setText(str(self.maximum()))
        return True
501634
def _onShortcutDuplicateLine(self):
        
        cursor = self.textCursor()
        if cursor.hasSelection():  # duplicate selection
            text = cursor.selectedText()
            selectionStart, selectionEnd = cursor.selectionStart(), cursor.selectionEnd()
            cursor.setPosition(selectionEnd)
            cursor.insertText(text)
            # restore selection
            cursor.setPosition(selectionStart)
            cursor.setPosition(selectionEnd, QTextCursor.KeepAnchor)
            self.setTextCursor(cursor)
        else:
            line = cursor.blockNumber()
            self.lines.insert(line + 1, self.lines[line])
            self.ensureCursorVisible()

        self._updateExtraSelections()
113756
def set_options(self, **options):
        
        opt2 = self._contexts[-1]
        for k, v in options.items():
            k2 = k.replace("_", "-")
            if v is None:
                opt2.pop(k2, None)
            else:
                opt2[k2] = v
1236303
def set_string(self, option, value):
        
        if not isinstance(value, str):
            raise TypeError("%s must be a string" % option)

        self.options[option] = value
601939
def _onShortcutCopyLine(self):
        
        lines = self.lines[self._selectedLinesSlice()]
        text = self._eol.join(lines)
        QApplication.clipboard().setText(text)
577554
def _setBlockIndent(self, block, indent):
        
        currentIndent = self._blockIndent(block)
        self._qpart.replaceText((block.blockNumber(), 0), len(currentIndent), indent)
1290294
def cut(args):
    
    p = OptionParser(cut.__doc__)
    p.add_option("--sep", default=".", help="Separator for splits")
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    agpfile, bedfile = args
    sep = opts.sep

    agp = AGP(agpfile)
    bed = Bed(bedfile)
    simple_agp = agp.order
    newagpfile = agpfile.replace(".agp", ".cut.agp")
    fw = open(newagpfile, "w")

    agp_fixes = defaultdict(list)
    for component, intervals in bed.sub_beds():
        i, a = simple_agp[component]
        object = a.object
        component_span = a.component_span
        orientation = a.orientation

        assert a.component_beg, a.component_end
        cuts = set()
        for i in intervals:
            start, end = i.start, i.end
            end -= 1

            assert start <= end
            cuts.add(start)
            cuts.add(end)

        cuts.add(0)
        cuts.add(component_span)
        cuts = list(sorted(cuts))

        sum_of_spans = 0
        for i, (a, b) in enumerate(pairwise(cuts)):
            oid = object + "{0}{1}".format(sep, i + 1)
            aline = [oid, 0, 0, 0]
            cspan = b - a
            aline += ['D', component, a + 1, b, orientation]
            sum_of_spans += cspan

            aline = "\t".join(str(x) for x in aline)
            agp_fixes[component].append(aline)

        assert component_span == sum_of_spans

    # Finally write the masked agp
    for a in agp:
        if not a.is_gap and a.component_id in agp_fixes:
            print("\n".join(agp_fixes[a.component_id]), file=fw)
        else:
            print(a, file=fw)

    fw.close()
    # Reindex
    reindex([newagpfile, "--inplace"])

    return newagpfile
481588
def cut_levels(self, loval, hival, no_reset=False):
        
        self.t_.set(cuts=(loval, hival))

        # If user specified "override" or "once" for auto levels,
        # then turn off auto levels now that they have set the levels
        # manually
        if (not no_reset) and (self.t_['autocuts'] in ('once', 'override')):
            self.t_.set(autocuts='off')