Commit 2e525f8a authored by tzutalin's avatar tzutalin
Browse files

Fix issue and disable choosing box color

parent 6cf04adf
......@@ -24,6 +24,6 @@ qt5py3:
pyrcc5 -o resources.py resources.qrc
clean:
rm -f .settings.pkl resources.pyc
rm -f ~/.labelImgSettings.pkl resources.pyc
.PHONY: test
......@@ -237,10 +237,8 @@ class MainWindow(QMainWindow, WindowMixin):
resetAll = action('&ResetAll', self.resetAll, None, 'resetall', u'Reset all')
color1 = action('Box &Line Color', self.chooseColor1,
color1 = action('Box Line Color', self.chooseColor1,
'Ctrl+L', 'color_line', u'Choose Box line color')
color2 = action('Box &Fill Color', self.chooseColor2,
'Ctrl+Shift+L', 'color', u'Choose Box fill color')
createMode = action('Create\nRectBox', self.setCreateMode,
'w', 'new', u'Start drawing Boxs', enabled=False)
......@@ -325,8 +323,7 @@ class MainWindow(QMainWindow, WindowMixin):
# Store actions for further handling.
self.actions = struct(save=save, saveAs=saveAs, open=open, close=close, resetAll = resetAll,
lineColor=color1, fillColor=color2,
create=create, delete=delete, edit=edit, copy=copy,
lineColor=color1, create=create, delete=delete, edit=edit, copy=copy,
createMode=createMode, editMode=editMode, advancedMode=advancedMode,
shapeLineColor=shapeLineColor, shapeFillColor=shapeFillColor,
zoom=zoom, zoomIn=zoomIn, zoomOut=zoomOut, zoomOrg=zoomOrg,
......@@ -336,7 +333,7 @@ class MainWindow(QMainWindow, WindowMixin):
open, opendir, save, saveAs, close, resetAll, quit),
beginner=(), advanced=(),
editMenu=(edit, copy, delete,
None, color1, color2),
None, color1),
beginnerContext=(create, edit, copy, delete),
advancedContext=(createMode, editMode, edit, copy,
delete, shapeLineColor, shapeFillColor),
......@@ -1254,15 +1251,6 @@ class MainWindow(QMainWindow, WindowMixin):
self.canvas.update()
self.setDirty()
def chooseColor2(self):
color = self.colorDialog.getColor(self.fillColor, u'Choose fill color',
default=DEFAULT_FILL_COLOR)
if color:
self.fillColor = color
Shape.fill_color = self.fillColor
self.canvas.update()
self.setDirty()
def deleteSelectedShape(self):
self.remLabel(self.canvas.deleteSelected())
self.setDirty()
......
......@@ -74,20 +74,8 @@ def fmtShortcut(text):
def generateColorByText(text):
color_table = []
color_table.append(QColor(0, 0, 50))
color_table.append(QColor(0, 0, 255))
color_table.append(QColor(0, 50, 0))
color_table.append(QColor(0, 255, 0))
color_table.append(QColor(50, 0, 0))
color_table.append(QColor(255, 0, 0))
color_table.append(QColor(0, 50, 50))
color_table.append(QColor(0, 255, 255))
color_table.append(QColor(50, 50, 0))
color_table.append(QColor(255, 255, 0))
color_table.append(QColor(50, 0, 50))
color_table.append(QColor(255, 0, 255))
color_table.append(QColor(50, 50, 50))
color_table.append(QColor(255, 255, 255))
colorInd = int(hashlib.sha1(text.encode('utf-8')).hexdigest(), 16) % len(color_table)
return color_table[colorInd]
hashCode = hash(text)
r = int((hashCode / 255) % 255)
g = int((hashCode / 65025) % 255)
b = int((hashCode / 16581375) % 255)
return QColor(r, g, b, 100)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment