Permalink
Browse files

pyNMS QT part 78

  • Loading branch information...
afourmy committed Aug 15, 2017
1 parent 73d4ee2 commit 65cdec9e11155fbe1ea036f101aa60e63a7cb0b3
View
BIN +810 KB Apps/putty.exe
Binary file not shown.
Binary file not shown.
View
BIN +1.37 MB (900%) Shapefiles/World countries.shp
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
BIN -92 KB Workspace/nodes.XLS
Binary file not shown.
View
@@ -72,9 +72,10 @@ def __init__(self, path_app):
# initialize all paths
self.path_app = path_app
path_parent = abspath(join(path_app, pardir))
self.path_apps = join(path_parent, 'Apps')
self.path_icon = join(path_parent, 'Icons')
self.path_workspace = join(path_parent, 'Workspace')
self.path_shapefiles = join(path_parent, 'Shapefiles')
self.path_workspace = join(path_parent, 'Workspace')
# a QMainWindow needs a central widget for the layout
central_widget = QWidget(self)
@@ -12,6 +12,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from os.path import join
from PyQt5.QtWidgets import (QApplication, QCheckBox, QGridLayout, QGroupBox,
QMenu, QPushButton, QRadioButton, QVBoxLayout, QWidget, QInputDialog, QLabel, QLineEdit, QComboBox, QListWidget, QAbstractItemView, QFileDialog)
@@ -24,21 +25,19 @@ def __init__(self, controller):
username = QLabel('Username')
self.username_edit = QLineEdit()
# self.username_edit.setMaximumWidth(120)
self.username_edit.setText('cisco')
password = QLabel('Password')
self.password_edit = QLineEdit()
# self.password_edit.setMaximumWidth(120)
self.password_edit.setText('cisco')
path_to_putty = QPushButton()
path_to_putty.setText('Path to PuTTY')
path_to_putty.clicked.connect(self.choose_path)
self.path_edit = QLineEdit()
# self.path_edit.setMaximumWidth(120)
self.path_edit.setText('C:/Users/minto/Desktop/Apps/putty.exe')
path = join(controller.path_apps, 'putty.exe')
self.path_edit.setText(path)
layout = QGridLayout()
layout.addWidget(username, 0, 0, 1, 1)
@@ -205,7 +205,7 @@ def troubleshoot(self):
def ssh_connection(self):
ssh_data = self.controller.ssh_management_window.get()
ssh_data['IP'] = self.node.ipaddress
ssh_data['IP'] = self.node.ip_address
ssh_connection = '{path} -ssh {username}@{IP} -pw {password}'
connect = Popen(ssh_connection.format(**ssh_data).split())
@@ -24,11 +24,11 @@
from pyproj import Proj
except ImportError:
warnings.warn('SHP librairies missing: map import disabled')
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtGui import (
QBrush,
QPen,
QColor,
QDrag,
QPainter,
@@ -106,13 +106,14 @@ class Map():
def __init__(self, view):
self.view = view
self.proj = 'spherical'
self.ratio, self.offset = 1/100, (0, 0)
self.ratio, self.offset = 1/500, (0, 0)
self.shapefile = join(self.view.controller.path_shapefiles, 'World countries.shp')
self.display = True
# brush for water and lands
self.water_brush = QBrush(QColor(64, 164, 223))
self.land_brush = QBrush(QColor(52, 165, 111))
self.land_pen = QPen(QColor(52, 165, 111))
# draw the map
self.polygons = self.view.scene.createItemGroup(self.draw_polygons())
@@ -159,6 +160,7 @@ def draw_polygons(self):
qt_polygon.append(QtCore.QPointF(px, py))
polygon_item = QtWidgets.QGraphicsPolygonItem(qt_polygon)
polygon_item.setBrush(self.land_brush)
polygon_item.setPen(self.land_pen)
polygon_item.setZValue(1)
yield polygon_item

0 comments on commit 65cdec9

Please sign in to comment.