Skip to content

Commit 74b8dfc

Browse files
committed
Fixes to run on Windows.
1 parent a249cdf commit 74b8dfc

File tree

7 files changed

+34
-14
lines changed

7 files changed

+34
-14
lines changed

gns3/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .version import __version__

gns3/main_window.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"""
2121

2222
import os
23+
import sys
2324
import tempfile
2425
import socket
2526
import shutil
@@ -743,15 +744,17 @@ def startupLoading(self):
743744
log.info("starting local server {} on {}:{}".format(servers.localServerPath(), server.host, server.port))
744745

745746
if not servers.localServerPath():
746-
log.info("not local server is configured")
747+
log.info("no local server is configured")
747748
return
748749

749-
if servers.startLocalServer(servers.localServerPath(), server.host, server.port):
750-
thread = WaitForConnectionThread(server.host, server.port)
751-
dialog = ProgressDialog(thread, "Local server", "Connecting...", "Cancel", busy=True, parent=self)
752-
dialog.show()
753-
if dialog.exec_() == False:
754-
return
750+
if sys.platform.startswith("win"):
751+
QtGui.QMessageBox.critical(self, "Local server", "Please manually start the server: All programs -> GNS3-ER -> GNS3 Server")
752+
elif servers.startLocalServer(servers.localServerPath(), server.host, server.port):
753+
thread = WaitForConnectionThread(server.host, server.port)
754+
self._progress_dialog = ProgressDialog(thread, "Local server", "Connecting...", "Cancel", busy=True, parent=self)
755+
self._progress_dialog.show()
756+
if self._progress_dialog.exec_() == False:
757+
return
755758
else:
756759
QtGui.QMessageBox.critical(self, "Local server", "Could not start the local server process: {}".format(servers.localServerPath()))
757760
return
@@ -798,14 +801,14 @@ def _saveProjectAs(self):
798801
# move files if saving from a temporary project
799802
log.info("moving project files from {} to {}".format(self._project_files_dir, new_project_files_dir))
800803
thread = ProcessFilesThread(self._project_files_dir, new_project_files_dir, move=True)
801-
dialog = ProgressDialog(thread, "Project", "Moving project files...", "Cancel", parent=self)
804+
self._progress_dialog = ProgressDialog(thread, "Project", "Moving project files...", "Cancel", parent=self)
802805
else:
803806
# else, just copy the files
804807
log.info("copying project files from {} to {}".format(self._project_files_dir, new_project_files_dir))
805808
thread = ProcessFilesThread(self._project_files_dir, new_project_files_dir)
806-
dialog = ProgressDialog(thread, "Project", "Copying project files...", "Cancel", parent=self)
807-
dialog.show()
808-
if not dialog.exec_():
809+
self._progress_dialog = ProgressDialog(thread, "Project", "Copying project files...", "Cancel", parent=self)
810+
self._progress_dialog.show()
811+
if not self._progress_dialog.exec_():
809812
return False
810813

811814
self._deleteTemporaryProject()

gns3/modules/dynamips/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ def setSettings(self, settings):
249249

250250
if params:
251251
for server in self._servers:
252+
if server.isLocal():
253+
params.update({"working_dir": self._working_dir})
254+
else:
255+
project_name = os.path.basename(self._working_dir)
256+
if project_name.endswith("-files"):
257+
project_name = project_name[:-6]
258+
params.update({"project_name": project_name})
252259
server.send_notification("dynamips.settings", params)
253260

254261
self._settings.update(settings)

gns3/modules/dynamips/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

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

gns3/modules/iou/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,15 @@ def setSettings(self, settings):
253253
# encode the iourc file in base64
254254
params["iourc"] = self._base64iourc(params["iourc"])
255255
for server in self._servers:
256+
# send the local working directory only if this is a local server
257+
if server.isLocal():
258+
params.update({"working_dir": self._working_dir})
259+
else:
260+
del params["iouyap"] # do not send iouyap path to remote servers
261+
project_name = os.path.basename(self._working_dir)
262+
if project_name.endswith("-files"):
263+
project_name = project_name[:-6]
264+
params.update({"project_name": project_name})
256265
server.send_notification("iou.settings", params)
257266

258267
self._settings.update(settings)

gns3/news_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, parent):
3535
QtGui.QDialog.__init__(self, parent)
3636
self.setupUi(self)
3737

38-
self.webpage = QtCore.QUrl('http://ads.gns3.net/ads.php')
38+
self.webpage = QtCore.QUrl('http://ads.gns3.net/er_ads.php')
3939
self.uiWebView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
4040
self.connect(self.uiWebView, QtCore.SIGNAL('linkClicked(const QUrl &)'), self._urlClickedSlot)
4141
self.connect(self.uiWebView, QtCore.SIGNAL('loadFinished(bool)'), self._loadFinishedSlot)

gns3/servers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _loadSettings(self):
5858

5959
# default path to the local GNS3 server executable or script
6060
if sys.platform.startswith("win"):
61-
DEFAULT_LOCAL_SERVER_PATH = "gns3server.exe"
61+
DEFAULT_LOCAL_SERVER_PATH = "C:/Program Files (x86)/GNS3-ER/gns3server.exe"
6262
else:
6363
# look for gns3server in PATH
6464
gns3server = None

0 commit comments

Comments
 (0)