Skip to content

Commit

Permalink
Move subviews to tab views to make it easier to switch views and to a…
Browse files Browse the repository at this point in the history
…dd more views in the future
  • Loading branch information
gregneagle committed Apr 23, 2015
1 parent 12f2233 commit 2719ef0
Show file tree
Hide file tree
Showing 2 changed files with 812 additions and 736 deletions.
27 changes: 15 additions & 12 deletions Imagr/MainController.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
import PyObjCTools

class MainController(NSObject):

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,15 @@ class MainController(NSObject):
blessTarget = None

def runStartupTasks(self):
self.loginView.setHidden_(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)
#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 @@ -106,17 +109,18 @@ def loadData(self):

def loadDataComplete(self):
# end modal sheet and close the panel
NSApp.endSheet_(self.progressPanel)
self.progressPanel.orderOut_(self)
#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.loginView.setHidden_(False)
#self.mainView.setHidden_(True)
self.theTabView.selectTabViewItem_(self.loginTab)
self.mainWindow.makeFirstResponder_(self.password)

@objc.IBAction
Expand All @@ -127,8 +131,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
Loading

0 comments on commit 2719ef0

Please sign in to comment.