Fixes to run on Windows.

This commit is contained in:
grossmj
2014-03-30 21:32:25 -06:00
parent a249cdfb85
commit 74b8dfc447
7 changed files with 34 additions and 14 deletions

View File

@@ -0,0 +1 @@
from .version import __version__

View File

@@ -20,6 +20,7 @@ Main window for the GUI.
"""
import os
import sys
import tempfile
import socket
import shutil
@@ -743,15 +744,17 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info("starting local server {} on {}:{}".format(servers.localServerPath(), server.host, server.port))
if not servers.localServerPath():
log.info("not local server is configured")
log.info("no local server is configured")
return
if servers.startLocalServer(servers.localServerPath(), server.host, server.port):
thread = WaitForConnectionThread(server.host, server.port)
dialog = ProgressDialog(thread, "Local server", "Connecting...", "Cancel", busy=True, parent=self)
dialog.show()
if dialog.exec_() == False:
return
if sys.platform.startswith("win"):
QtGui.QMessageBox.critical(self, "Local server", "Please manually start the server: All programs -> GNS3-ER -> GNS3 Server")
elif servers.startLocalServer(servers.localServerPath(), server.host, server.port):
thread = WaitForConnectionThread(server.host, server.port)
self._progress_dialog = ProgressDialog(thread, "Local server", "Connecting...", "Cancel", busy=True, parent=self)
self._progress_dialog.show()
if self._progress_dialog.exec_() == False:
return
else:
QtGui.QMessageBox.critical(self, "Local server", "Could not start the local server process: {}".format(servers.localServerPath()))
return
@@ -798,14 +801,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# move files if saving from a temporary project
log.info("moving project files from {} to {}".format(self._project_files_dir, new_project_files_dir))
thread = ProcessFilesThread(self._project_files_dir, new_project_files_dir, move=True)
dialog = ProgressDialog(thread, "Project", "Moving project files...", "Cancel", parent=self)
self._progress_dialog = ProgressDialog(thread, "Project", "Moving project files...", "Cancel", parent=self)
else:
# else, just copy the files
log.info("copying project files from {} to {}".format(self._project_files_dir, new_project_files_dir))
thread = ProcessFilesThread(self._project_files_dir, new_project_files_dir)
dialog = ProgressDialog(thread, "Project", "Copying project files...", "Cancel", parent=self)
dialog.show()
if not dialog.exec_():
self._progress_dialog = ProgressDialog(thread, "Project", "Copying project files...", "Cancel", parent=self)
self._progress_dialog.show()
if not self._progress_dialog.exec_():
return False
self._deleteTemporaryProject()

View File

@@ -249,6 +249,13 @@ class Dynamips(Module):
if params:
for server in self._servers:
if server.isLocal():
params.update({"working_dir": self._working_dir})
else:
project_name = os.path.basename(self._working_dir)
if project_name.endswith("-files"):
project_name = project_name[:-6]
params.update({"project_name": project_name})
server.send_notification("dynamips.settings", params)
self._settings.update(settings)

View File

@@ -24,7 +24,7 @@ import os
# default path to Dynamips executable
if sys.platform.startswith("win"):
DEFAULT_DYNAMIPS_PATH = "dynamips.exe"
DEFAULT_DYNAMIPS_PATH = "C:/Program Files (x86)/GNS3-ER/dynamips.exe"
elif sys.platform.startswith('darwin'):
if hasattr(sys, "frozen"):
DEFAULT_DYNAMIPS_PATH = os.path.join(os.getcwdu(), "../Resources/dynamips-0.2.12-OSX.intel64.bin")

View File

@@ -253,6 +253,15 @@ class IOU(Module):
# encode the iourc file in base64
params["iourc"] = self._base64iourc(params["iourc"])
for server in self._servers:
# send the local working directory only if this is a local server
if server.isLocal():
params.update({"working_dir": self._working_dir})
else:
del params["iouyap"] # do not send iouyap path to remote servers
project_name = os.path.basename(self._working_dir)
if project_name.endswith("-files"):
project_name = project_name[:-6]
params.update({"project_name": project_name})
server.send_notification("iou.settings", params)
self._settings.update(settings)

View File

@@ -35,7 +35,7 @@ class NewsDialog(QtGui.QDialog, Ui_NewsDialog):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.webpage = QtCore.QUrl('http://ads.gns3.net/ads.php')
self.webpage = QtCore.QUrl('http://ads.gns3.net/er_ads.php')
self.uiWebView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
self.connect(self.uiWebView, QtCore.SIGNAL('linkClicked(const QUrl &)'), self._urlClickedSlot)
self.connect(self.uiWebView, QtCore.SIGNAL('loadFinished(bool)'), self._loadFinishedSlot)

View File

@@ -58,7 +58,7 @@ class Servers(QtCore.QObject):
# default path to the local GNS3 server executable or script
if sys.platform.startswith("win"):
DEFAULT_LOCAL_SERVER_PATH = "gns3server.exe"
DEFAULT_LOCAL_SERVER_PATH = "C:/Program Files (x86)/GNS3-ER/gns3server.exe"
else:
# look for gns3server in PATH
gns3server = None