Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #36 from gregneagle/master
Browse files Browse the repository at this point in the history
Move views to tab panels
  • Loading branch information
grahamgilbert committed Apr 24, 2015
2 parents e39161b + 744d3e8 commit a630b02
Show file tree
Hide file tree
Showing 2 changed files with 806 additions and 871 deletions.
29 changes: 11 additions & 18 deletions Imagr/MainController.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@
import PyObjCTools

class MainController(NSObject):

mainWindow = objc.IBOutlet()

theTabView = objc.IBOutlet()
introTab = objc.IBOutlet()
loginTab = objc.IBOutlet()
mainTab = objc.IBOutlet()

password = objc.IBOutlet()
passwordLabel = objc.IBOutlet()
loginLabel = objc.IBOutlet()
loginButton = objc.IBOutlet()
errorField = objc.IBOutlet()
mainWindow = objc.IBOutlet()

mainView = objc.IBOutlet()
loginView = objc.IBOutlet()

progressPanel = objc.IBOutlet()
progressIndicator = objc.IBOutlet()
progressText = objc.IBOutlet()

Expand Down Expand Up @@ -72,15 +75,10 @@ class MainController(NSObject):
blessTarget = None

def runStartupTasks(self):
self.loginView.setHidden_(self)
self.mainWindow.center()
#self.progressPanel.center()
#self.password.becomeFirstResponder()
# Run app startup - get the images, password, volumes - anything that takes a while

self.progressText.setStringValue_("Application Starting...")
NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_(
self.progressPanel, self.mainWindow, self, None, None)
self.progressIndicator.setIndeterminate_(True)
self.progressIndicator.setUsesThreadedAnimation_(True)
self.progressIndicator.startAnimation_(self)
Expand All @@ -105,18 +103,14 @@ def loadData(self):
del pool

def loadDataComplete(self):
# end modal sheet and close the panel
NSApp.endSheet_(self.progressPanel)
self.progressPanel.orderOut_(self)
if not self.passwordHash:
self.password.setEnabled_(False)
self.loginButton.setEnabled_(False)
self.disableAllButtons(self)
self.startUpDiskText.setStringValue_(
"No Server URL has been set. Please contact your administrator.")
self.setStartupDisk_(self)
self.loginView.setHidden_(False)
self.mainView.setHidden_(True)
self.theTabView.selectTabViewItem_(self.loginTab)
self.mainWindow.makeFirstResponder_(self.password)

@objc.IBAction
Expand All @@ -127,8 +121,7 @@ def login_(self, sender):
self.errorField.setEnabled_(sender)
self.errorField.setStringValue_("Incorrect password")
else:
self.loginView.setHidden_(sender)
self.mainView.setHidden_(False)
self.theTabView.selectTabViewItem_(self.mainTab)
self.chooseImagingTarget_(sender)
self.enableAllButtons_(self)

Expand Down Expand Up @@ -314,7 +307,7 @@ def updateProgressWithInfo_(self, info):
self.imagingProgressDetail.setStringValue_(info['detail'])

def updateProgressTitle_Percent_Detail_(self, title, percent, detail):
'''Wrapper method that calls the UI updadte method on the main thread'''
'''Wrapper method that calls the UI update method on the main thread'''
info = {}
if title is not None:
info['title'] = title
Expand Down
Loading

0 comments on commit a630b02

Please sign in to comment.