summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Smith <bruce@nanorex.com>2008-12-30 23:41:33 +0000
committerBruce Smith <bruce@nanorex.com>2008-12-30 23:41:33 +0000
commit936aa867875b9407a5510fa51b3ff317274d6f3f (patch)
tree9c4f5013d509fad9e01ace5c83435437ee4db3cd
parenta61b8e998ba3a10b1b963dfe374d6c74420f3011 (diff)
downloadnanoengineer-936aa867875b9407a5510fa51b3ff317274d6f3f.tar.gz
nanoengineer-936aa867875b9407a5510fa51b3ff317274d6f3f.zip
refactoring, reformatting, comments, debug code
-rwxr-xr-xcad/src/commands/Select/Select_GraphicsMode.py34
-rwxr-xr-xcad/src/history/HistoryWidget.py13
-rwxr-xr-xcad/src/widgets/StatusBar.py36
3 files changed, 64 insertions, 19 deletions
diff --git a/cad/src/commands/Select/Select_GraphicsMode.py b/cad/src/commands/Select/Select_GraphicsMode.py
index 21974846d..cab66bdf3 100755
--- a/cad/src/commands/Select/Select_GraphicsMode.py
+++ b/cad/src/commands/Select/Select_GraphicsMode.py
@@ -964,27 +964,39 @@ class Select_basicGraphicsMode(Select_GraphicsMode_DrawMethod_preMixin,
if new_selobj_unknown:
# Only the next paintGL call can figure out the selobj (in general),
- # so set glpane.glselect_wanted to the command to do that and the necessary info for doing it.
+ # so set glpane.glselect_wanted to the command to do that and the
+ # necessary info for doing it.
# Note: it might have been set before and not yet used;
# if so, it's good to discard that old info, as we do.
glpane.glselect_wanted = (wX, wY, wZ) # mouse pos, depth
- ###e and soon, instructions about whether to highlight selobj based on its type (as predicate on selobj)
+ ###e and soon, instructions about whether to highlight selobj
+ # based on its type (as predicate on selobj)
###e should also include current count of number of times
# glupdate was ever called because model looks different,
- # and inval these instrs if that happens again before they are used
- # (since in that case wZ is no longer correct)
- # don't change glpane.selobj (since it might not even need to change) (ok??#k) -- the next paintGL will do that --
- # UNLESS the current mode wants us to change it [new feature, bruce 061218, perhaps a temporary kluge, but helps
- # avoid a logic bug in this code, experienced often in testmode due to its slow redraw]
+ # and inval these instrs if that happens again before they
+ # are used (since in that case wZ is no longer correct)
+
+ # [addendum, bruce 081230: this is nonmodular -- we should call
+ # a glpane method to set that, and make it private.]
+
+ # don't change glpane.selobj (since it might not even need to
+ # change) (ok??#k) -- the next paintGL will do that --
+ # UNLESS the current mode wants us to change it
+ # [new feature, bruce 061218, perhaps a temporary kluge, but helps
+ # avoid a logic bug in this code, experienced often in testmode
+ # due to its slow redraw]
#
- # Note: I'm mostly guessing that this should be found in (and unique to) graphicsMode
- # rather than currentCommand, in spite of being set only in testmode by current code.
+ # Note: I'm mostly guessing that this should be found in
+ # (and unique to) graphicsMode rather than currentCommand,
+ # in spite of being set only in testmode by current code.
# That does make this code simpler, since graphicsMode is self.
- # [bruce 071010, same comment and change done in both duplications of this code, and in other places]
+ # [bruce 071010, same comment and change done in both duplications
+ # of this code, and in other places]
if hasattr(self, 'UNKNOWN_SELOBJ'):
- # TODO: document the motivation for this [bruce 081211 comment]
+ # for motivation, see comment above, dated 061218
glpane.selobj = getattr(self, 'UNKNOWN_SELOBJ')
## print "\n*** changed glpane.selobj from %r to %r" % (orig_selobj, glpane.selobj)
+
glpane.gl_update_for_glselect()
else:
# it's known (to be a specific object or None)
diff --git a/cad/src/history/HistoryWidget.py b/cad/src/history/HistoryWidget.py
index 7b1feedb2..5e2ac71ef 100755
--- a/cad/src/history/HistoryWidget.py
+++ b/cad/src/history/HistoryWidget.py
@@ -589,12 +589,12 @@ class HistoryWidget:
@type msg_text: string
@param repaint: Forces a repaint of the status bar with the new message.
- This doesn't work (see Bruce's comments in code).
+ This doesn't work (see comments in code).
@param repaint: boolean
"""
win = env.mainwindow()
sbar = win.statusBar()
-
+
if msg_text:
sbar.showMessage(msg_text)
else:
@@ -608,9 +608,16 @@ class HistoryWidget:
return
def progress_msg(self, msg_text): # Bug 1343, wware 060310
+ """
+ Display and/or record a progress message in an appropriate place.
+
+ @note: for now, the place is always a dedicated label in the statusbar,
+ and these messages are never recorded. In the future this might
+ be revised based on user prefs.
+ """
win = env.mainwindow()
statusBar = win.statusBar()
- statusBar.statusMsgLabel.setText(msg_text)
+ statusBar._f_progress_msg(msg_text) #bruce 081229 refactoring
def widget_msg(self, msg, options):
#e improved timestamp?
diff --git a/cad/src/widgets/StatusBar.py b/cad/src/widgets/StatusBar.py
index a77d5e545..cbd1fc9e8 100755
--- a/cad/src/widgets/StatusBar.py
+++ b/cad/src/widgets/StatusBar.py
@@ -37,7 +37,6 @@ from platform_dependent.PlatformDependent import hhmmss_str #bruce 060106 moved
import foundation.env as env
from utilities.icon_utilities import geticon
from utilities.icon_utilities import getpixmap
-from utilities.Log import redmsg #bruce 060208 fix bug in traceback printing re bug 1263 (doesn't fix 1263 itself)
from utilities.qt4transition import qt4todo
from utilities.debug import print_compact_traceback
from widgets.GlobalDisplayStylesComboBox import GlobalDisplayStylesComboBox
@@ -45,11 +44,11 @@ from widgets.GlobalDisplayStylesComboBox import GlobalDisplayStylesComboBox
class StatusBar(QStatusBar):
def __init__(self, win):
QStatusBar.__init__(self, win)
- self.statusMsgLabel = QLabel()
+ self._progressLabel = QLabel()
- self.statusMsgLabel.setMinimumWidth(200)
- self.statusMsgLabel.setFrameStyle( QFrame.Panel | QFrame.Sunken )
- self.addPermanentWidget(self.statusMsgLabel)
+ self._progressLabel.setMinimumWidth(200)
+ self._progressLabel.setFrameStyle( QFrame.Panel | QFrame.Sunken )
+ self.addPermanentWidget(self._progressLabel)
self.progressBar = QProgressBar(win)
self.progressBar.setMaximumWidth(250)
@@ -81,7 +80,32 @@ class StatusBar(QStatusBar):
self.addPermanentWidget(self.selectionLockButton)
self.abortableCommands = {}
+
+ #bruce 081230 debug code:
+ ## self.connect(self, SIGNAL('messageChanged ( const QString &)'),
+ ## self.slotMessageChanged )
+## def slotMessageChanged(self, message): # bruce 081230 debug code
+## print "messageChanged: %r" % str(message)
+
+ def showMessage(self, text): #bruce 081230
+ """
+ [extends superclass method]
+ """
+ ## QStatusBar.showMessage(self, " ")
+ QStatusBar.showMessage(self, text)
+ ## print "message was set to %r" % str(self.currentMessage())
+ return
+
+ def _f_progress_msg(self, text): #bruce 081229 refactoring
+ """
+ Friend method for use only by present implementation
+ of env.history.progress_msg. Display text in our
+ private label widget dedicated to progress messages.
+ """
+ self._progressLabel.setText(msg_text)
+ return
+
def makeCommandNameUnique(self, commandName):
index = 1
trial = commandName
@@ -181,6 +205,8 @@ class StatusBar(QStatusBar):
displayedElapsedTime = elapsedTime
env.history.progress_msg("Elapsed Time: " +
hhmmss_str(displayedElapsedTime))
+ # note: it's intentional that this doesn't directly call
+ # self._f_progress_msg. [bruce 081229 comment]
if abortHandler.getPressCount() > 0:
env.history.statusbar_msg("Aborted.")