Skip to content

Commit

Permalink
pyNMS QT part 78
Browse files Browse the repository at this point in the history
  • Loading branch information
afourmy committed Aug 15, 2017
1 parent 73d4ee2 commit 65cdec9
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 8 deletions.
Binary file added Apps/putty.exe
Binary file not shown.
Binary file added Shapefiles/World countries (low resolution).shp
Binary file not shown.
Binary file modified Shapefiles/World countries.shp
Binary file not shown.
Binary file removed Shapefiles/World countries2.shp
Binary file not shown.
Binary file removed Shapefiles/World countries3.shp
Binary file not shown.
Binary file removed Shapefiles/World countries4.shp
Binary file not shown.
Binary file removed Workspace/nodes.XLS
Binary file not shown.
3 changes: 2 additions & 1 deletion pyNMS/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions pyNMS/ip_networks/ssh_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyNMS/right_click_menus/network_selection_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
6 changes: 4 additions & 2 deletions pyNMS/views/geographical_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 65cdec9

Please sign in to comment.