Merge pull request #227 from tomasra/master
Show cursor coordinates in status bar + filepath bugfix
This commit is contained in:
commit
1270b2c778
10
labelImg.py
10
labelImg.py
@ -176,7 +176,7 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
self.zoomWidget = ZoomWidget()
|
self.zoomWidget = ZoomWidget()
|
||||||
self.colorDialog = ColorDialog(parent=self)
|
self.colorDialog = ColorDialog(parent=self)
|
||||||
|
|
||||||
self.canvas = Canvas()
|
self.canvas = Canvas(parent=self)
|
||||||
self.canvas.zoomRequest.connect(self.zoomRequest)
|
self.canvas.zoomRequest.connect(self.zoomRequest)
|
||||||
|
|
||||||
scroll = QScrollArea()
|
scroll = QScrollArea()
|
||||||
@ -456,6 +456,10 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
|
|
||||||
self.populateModeActions()
|
self.populateModeActions()
|
||||||
|
|
||||||
|
# Display cursor coordinates at the right of status bar
|
||||||
|
self.labelCoordinates = QLabel('')
|
||||||
|
self.statusBar().addPermanentWidget(self.labelCoordinates)
|
||||||
|
|
||||||
## Support Functions ##
|
## Support Functions ##
|
||||||
|
|
||||||
def noShapes(self):
|
def noShapes(self):
|
||||||
@ -525,6 +529,7 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
self.imageData = None
|
self.imageData = None
|
||||||
self.labelFile = None
|
self.labelFile = None
|
||||||
self.canvas.resetState()
|
self.canvas.resetState()
|
||||||
|
self.labelCoordinates.clear()
|
||||||
|
|
||||||
def currentItem(self):
|
def currentItem(self):
|
||||||
items = self.labelList.selectedItems()
|
items = self.labelList.selectedItems()
|
||||||
@ -888,6 +893,9 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
if filePath is None:
|
if filePath is None:
|
||||||
filePath = self.settings.get(SETTING_FILENAME)
|
filePath = self.settings.get(SETTING_FILENAME)
|
||||||
|
|
||||||
|
# Make sure that filePath is a regular python string, rather than QString
|
||||||
|
filePath = str(filePath)
|
||||||
|
|
||||||
unicodeFilePath = ustr(filePath)
|
unicodeFilePath = ustr(filePath)
|
||||||
# Tzutalin 20160906 : Add file list and dock to move faster
|
# Tzutalin 20160906 : Add file list and dock to move faster
|
||||||
# Highlight the file item
|
# Highlight the file item
|
||||||
|
|||||||
@ -104,6 +104,12 @@ class Canvas(QWidget):
|
|||||||
"""Update line with last point and current coordinates."""
|
"""Update line with last point and current coordinates."""
|
||||||
pos = self.transformPos(ev.pos())
|
pos = self.transformPos(ev.pos())
|
||||||
|
|
||||||
|
# Update coordinates in status bar if image is opened
|
||||||
|
window = self.parent().window()
|
||||||
|
if window.filePath is not None:
|
||||||
|
self.parent().window().labelCoordinates.setText(
|
||||||
|
'X: %d; Y: %d' % (pos.x(), pos.y()))
|
||||||
|
|
||||||
# Polygon drawing.
|
# Polygon drawing.
|
||||||
if self.drawing():
|
if self.drawing():
|
||||||
self.overrideCursor(CURSOR_DRAW)
|
self.overrideCursor(CURSOR_DRAW)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user