Skip to content
Permalink
Browse files

Fixes new project dialog not centered on the same screen as the main

window.
  • Loading branch information...
grossmj committed Jul 6, 2014
1 parent d04db9a commit a110f9e7004dc6c6947f1a3d677fc433ac448685
Showing with 31 additions and 31 deletions.
  1. +31 −31 src/GNS3/Application.py
@@ -27,6 +27,7 @@
from distutils.version import LooseVersion
from PyQt4.QtGui import QApplication, QSplashScreen, QPixmap, QMessageBox, QStyleFactory
from PyQt4.QtCore import Qt, QVariant, QSettings, QEventLoop
from PyQt4 import QtCore
from GNS3.Utils import Singleton, translate
from GNS3.Workspace import Workspace
from GNS3.Config.Objects import systemDynamipsConf, systemGeneralConf, systemCaptureConf, systemQemuConf, systemVBoxConf, systemDeployementWizardConf
@@ -412,6 +413,8 @@ def showTipsDialog(self):

def run(self, file):


self._file = file
# Display splash screen while waiting for the application to open
self.processSplashScreen()

@@ -599,10 +602,35 @@ def run(self, file):
if self.mainWindow.tips_dialog:
self.mainWindow.tips_dialog.checkBoxDontShowAgain.setChecked(ConfDB().value("GUIState/DoNotShowTipsDialog", QVariant(False)).toBool())

# load initial stuff once the event loop isn't busy
QtCore.QTimer.singleShot(0, self._startupLoading)

# By default, don't show the NodeTypes dock
self.mainWindow.dockWidget_NodeTypes.setVisible(False)
self.mainWindow.show()

retcode = QApplication.exec_()

self.__HypervisorManager = None
self.__QemuManager = None
self.__VBoxManager = None

if globals.recordConfiguration:
# Save the geometry & state of the GUI
ConfDB().set("GUIState/Geometry", self.mainWindow.saveGeometry())
ConfDB().set("GUIState/State", self.mainWindow.saveState())
ConfDB().set("GUIState/DisableMouseWheel", self.mainWindow.action_DisableMouseWheel.isChecked())
ConfDB().set("GUIState/ZoomUsingMouseWheel", self.mainWindow.action_ZoomUsingMouseWheel.isChecked())
if self.mainWindow.tips_dialog:
ConfDB().set("GUIState/DoNotShowTipsDialog", self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked())
self.syncConf()

self.deleteLater()
sys.exit(retcode)

def _startupLoading(self):

confo = self.systconf['general']
force_clear_configuration = True
version = ConfDB().get('GNS3/version', '0.0.1')
try:
@@ -633,24 +661,15 @@ def run(self, file):
configFile = unicode(ConfDB().fileName(), 'utf-8', errors='replace')
if not os.access(configFile, os.F_OK):
dialog = Wizard(parent=self.mainWindow)
dialog.setModal(True)
dialog.show()
self.mainWindow.centerDialog(dialog)
dialog.raise_()
dialog.activateWindow()
self.mainWindow.raise_()
dialog.raise_()
else:
if file:
self.mainWindow.load_netfile(file, load_instructions=True)
if self._file:
self.mainWindow.load_netfile(self._file, load_instructions=True)
elif confo.project_startup and os.access(configFile, os.F_OK):
dialog = ProjectDialog(parent=self.mainWindow, newProject=True)
dialog.setModal(True)
dialog.show()
self.mainWindow.centerDialog(dialog)
dialog.raise_()
dialog.activateWindow()
self.mainWindow.raise_()
dialog.raise_()
if self.mainWindow.tips_dialog and self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked() == False:
self.showTipsDialog()
else:
@@ -659,25 +678,6 @@ def run(self, file):
if self.mainWindow.tips_dialog and self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked() == False:
self.showTipsDialog()

retcode = QApplication.exec_()

self.__HypervisorManager = None
self.__QemuManager = None
self.__VBoxManager = None

if globals.recordConfiguration:
# Save the geometry & state of the GUI
ConfDB().set("GUIState/Geometry", self.mainWindow.saveGeometry())
ConfDB().set("GUIState/State", self.mainWindow.saveState())
ConfDB().set("GUIState/DisableMouseWheel", self.mainWindow.action_DisableMouseWheel.isChecked())
ConfDB().set("GUIState/ZoomUsingMouseWheel", self.mainWindow.action_ZoomUsingMouseWheel.isChecked())
if self.mainWindow.tips_dialog:
ConfDB().set("GUIState/DoNotShowTipsDialog", self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked())
self.syncConf()

self.deleteLater()
sys.exit(retcode)

def syncConf(self):
""" Sync current application config with config file (gns3.{ini,conf})
"""

0 comments on commit a110f9e

Please sign in to comment.
You can’t perform that action at this time.