mirror of https://github.com/NaN-tic/nanscan.git
Ease logging in and add login information in statusbar.
This commit is contained in:
parent
a5506050fa
commit
f425f17d73
|
@ -427,6 +427,7 @@ class MainWindow(QMainWindow):
|
|||
self.connect( self.actionDelete, SIGNAL('triggered()'), self.removeTemplateBox )
|
||||
self.connect( self.actionZoom, SIGNAL('triggered()'), self.zoom )
|
||||
self.connect( self.actionUnzoom, SIGNAL('triggered()'), self.unzoom )
|
||||
self.connect( self.actionFindMatchingTemplate, SIGNAL('triggered()'), self.findMatchingTemplate )
|
||||
self.toggleImageBoxes()
|
||||
QTimer.singleShot( 1000, self.setup )
|
||||
self.updateTitle()
|
||||
|
@ -442,6 +443,10 @@ class MainWindow(QMainWindow):
|
|||
|
||||
#rpc.session.login( 'http://admin:admin@127.0.0.1:8069', 'g1' )
|
||||
|
||||
def findMatchingTemplate(self):
|
||||
print "Finding matching template"
|
||||
self.recognizer.findMatchingTemplate( [] )
|
||||
|
||||
def recognizerChanged(self, recognizer):
|
||||
rect = self.uiTool.box.rect
|
||||
self.uiTool.setText( self.scene.recognizer.textInRegion( rect, recognizer ) )
|
||||
|
@ -505,12 +510,18 @@ class MainWindow(QMainWindow):
|
|||
self.uiView.scale( 0.8, 0.8 )
|
||||
|
||||
def login(self):
|
||||
LoginDialog.defaultHost = 'localhost'
|
||||
LoginDialog.defaultPort = 8070
|
||||
LoginDialog.defaultProtocol = 'socket://'
|
||||
LoginDialog.defaultUserName = 'admin'
|
||||
dialog = LoginDialog( self )
|
||||
if dialog.exec_() == QDialog.Rejected:
|
||||
return False
|
||||
if rpc.session.login( dialog.url, dialog.databaseName ) > 0:
|
||||
self.updateTitle()
|
||||
return True
|
||||
else:
|
||||
self.updateTitle()
|
||||
return False
|
||||
|
||||
def newTemplate(self):
|
||||
|
@ -602,6 +613,16 @@ class MainWindow(QMainWindow):
|
|||
|
||||
def updateTitle(self):
|
||||
self.setWindowTitle( "Planta - [%s]" % self._template.name )
|
||||
|
||||
if rpc.session.logged():
|
||||
server = '%s [%s]' % (rpc.session.url, rpc.session.databaseName)
|
||||
else:
|
||||
shortcut = unicode( self.actionLogin.shortcut().toString() )
|
||||
if shortcut:
|
||||
server = _('Press %s to login') % shortcut
|
||||
else:
|
||||
server = 'not logged in'
|
||||
self.statusBar().showMessage( server )
|
||||
|
||||
def updateActions(self):
|
||||
# Allow deleting if there's a TemplateBox selected
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<width>709</width>
|
||||
<height>487</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>48</y>
|
||||
<width>524</width>
|
||||
<width>709</width>
|
||||
<height>417</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -59,7 +59,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<width>709</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -91,8 +91,15 @@
|
|||
</property>
|
||||
<addaction name="actionDelete" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Actions" >
|
||||
<property name="title" >
|
||||
<string>&Actions</string>
|
||||
</property>
|
||||
<addaction name="actionFindMatchingTemplate" />
|
||||
</widget>
|
||||
<addaction name="menuFile" />
|
||||
<addaction name="menuEdit" />
|
||||
<addaction name="menu_Actions" />
|
||||
<addaction name="menuView" />
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" >
|
||||
|
@ -100,7 +107,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>465</y>
|
||||
<width>524</width>
|
||||
<width>709</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -110,7 +117,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>22</y>
|
||||
<width>524</width>
|
||||
<width>709</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -156,6 +163,9 @@
|
|||
<property name="text" >
|
||||
<string>&Login</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveTemplate" >
|
||||
<property name="text" >
|
||||
|
@ -228,6 +238,11 @@
|
|||
<string>Show Feature Boxes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFindMatchingTemplate" >
|
||||
<property name="text" >
|
||||
<string>Find Matching Template</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in New Issue