...
 
Commits (4)
......@@ -275,7 +275,8 @@ void KisFillPainter::genericFillStart(int startX, int startY, KisPaintDeviceSP s
// Create a selection from the surrounding area
KisPixelSelectionSP pixelSelection = createFloodSelection(startX, startY, sourceDevice, selection()->pixelSelection());
KisPixelSelectionSP pixelSelection = createFloodSelection(startX, startY, sourceDevice,
(selection().isNull() ? 0 : selection()->pixelSelection()));
KisSelectionSP newSelection = new KisSelection(pixelSelection->defaultBounds());
newSelection->pixelSelection()->applySelection(pixelSelection, SELECTION_REPLACE);
m_fillSelection = newSelection;
......@@ -344,7 +345,7 @@ KisPixelSelectionSP KisFillPainter::createFloodSelection(KisPixelSelectionSP pix
KisScanlineFill gc(sourceDevice, startPoint, fillBoundsRect);
gc.setThreshold(m_threshold);
if (m_useSelectionAsBoundary) {
if (m_useSelectionAsBoundary && !pixelSelection.isNull()) {
gc.fillSelectionWithBoundary(pixelSelection, existingSelection);
} else {
gc.fillSelection(pixelSelection);
......
......@@ -125,7 +125,7 @@ void FillProcessingVisitor::fillPaintDevice(KisPaintDeviceSP device, KisUndoAdap
fillPainter.setFeather(m_feather);
fillPainter.setFillThreshold(m_fillThreshold);
fillPainter.setCareForSelection(true);
fillPainter.setUseSelectionAsBoundary((m_selection.isNull() || m_selection->hasNonEmptyPixelSelection()) ? m_useSelectionAsBoundary : false);
fillPainter.setUseSelectionAsBoundary((m_selection.isNull() || !m_selection->hasNonEmptyPixelSelection()) ? false : m_useSelectionAsBoundary);
fillPainter.setWidth(fillRect.width());
fillPainter.setHeight(fillRect.height());
fillPainter.setUseCompositioning(!m_useFastMode);
......
......@@ -670,6 +670,22 @@ void KisAssistantTool::mouseMoveEvent(KoPointerEvent *event)
m_canvas->updateCanvas();
}
void KisAssistantTool::keyPressEvent(QKeyEvent *event)
{
// When the user is in the middle of creating a new
// assistant the escape key can be used to cancel this process.
if (event->key()==Qt::Key_Escape && (m_newAssistant)) {
// Clear shared pointer to the assistant being created so
// it gets cleaned-up
m_newAssistant.clear();
m_canvas->updateCanvas();
event->accept();
} else {
event->ignore();
}
}
void KisAssistantTool::paint(QPainter& _gc, const KoViewConverter &_converter)
{
QRectF canvasSize = QRectF(QPointF(0, 0), QSizeF(m_canvas->image()->size()));
......
......@@ -73,6 +73,7 @@ public:
void continuePrimaryAction(KoPointerEvent *event) override;
void endPrimaryAction(KoPointerEvent *event) override;
void mouseMoveEvent(KoPointerEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
QWidget *createOptionWidget() override;
......
# This script is licensed CC 0 1.0, so that you can learn from it.
# ------ CC 0 1.0 ---------------
# The person who associated a work with this deed has dedicated the
# work to the public domain by waiving all of his or her rights to the
# work worldwide under copyright law, including all related and
# neighboring rights, to the extent allowed by law.
# You can copy, modify, distribute and perform the work, even for
# commercial purposes, all without asking permission.
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
from krita import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
......@@ -106,7 +120,7 @@ class PhotobashDocker(DockWidget):
nextButton.setArrowType(Qt.ArrowType.RightArrow)
self.sliderLabel = QLabel(self.mainWidget)
self.sliderLabel.setText(f"Image Scale : {self.currImageScale}%")
self.sliderLabel.setText(f"Scale : {self.currImageScale}%")
self.sliderLabel.setMaximumWidth(self.sliderLabel.fontMetrics().width(self.sliderLabel.text()))
slider = QSlider(Qt.Horizontal, self)
......@@ -117,7 +131,7 @@ class PhotobashDocker(DockWidget):
slider.valueChanged.connect(self.updateScale)
fitBordersLabel = QLabel(self.mainWidget)
fitBordersLabel.setText("Fit to Canvas")
fitBordersLabel.setText("Fit Canvas")
fitBordersLabel.setMaximumWidth(fitBordersLabel.fontMetrics().width(fitBordersLabel.text()))
fitCanvasCheckBox = QCheckBox(self.mainWidget)
......@@ -218,7 +232,7 @@ class PhotobashDocker(DockWidget):
fileDialog.setFileMode(QFileDialog.DirectoryOnly);
if self.directoryPath == "":
self.directoryPath = fileDialog.getExistingDirectory()
self.directoryPath = fileDialog.getExistingDirectory(self.mainWidget, "Change Directory for Images", QStandardPaths.writableLocation(QStandardPaths.PicturesLocation))
Application.writeSetting(self.applicationName, self.referencesSetting, self.directoryPath)
else:
self.directoryPath = fileDialog.getExistingDirectory(self.mainWidget, "Change Directory for Images", self.directoryPath)
......