# Path: PyContact/gui/Dialogues.py
# class TopoTrajLoaderDialog(QDialog):
#     """Dialog to load the topology and trajectory file."""
#     def __init__(self, parent=None):
#         super(TopoTrajLoaderDialog, self).__init__(parent)
#         self.setWindowTitle("Load Data")
#         self.psf = ""
#         self.dcd = ""
# 
#         grid = QGridLayout(self)
# 
#         buttonPsf = QPushButton("Topology")
#         buttonPsf.clicked.connect(self.pick_psf)
# 
#         buttonDcd = QPushButton("Trajectory")
#         buttonDcd.clicked.connect(self.pick_dcd)
# 
#         helpButton = HelpButton()
# 
#         grid.addWidget(buttonPsf, 0, 0)
#         grid.addWidget(buttonDcd, 0, 1)
#         buttons = QDialogButtonBox(
#             QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
#             Qt.Horizontal, self)
#         buttons.accepted.connect(self.accept)
#         buttons.rejected.connect(self.reject)
#         grid.addWidget(buttons, 1, 0)
#         grid.addWidget(helpButton, 2, 0)
# 
#     def pick_psf(self):
#         """Pick the topology file."""
#         psfname = QFileDialog.getOpenFileNames(self, "Open topology")
#         for file in psfname[0]:
#             self.psf = file
#             break
# 
#     def pick_dcd(self):
#         """Pick the trajectory file."""
#         dcdname = QFileDialog.getOpenFileNames(self, "Open trajectory")
#         for file in dcdname[0]:
#             self.dcd = file
#             break
# 
#     def configuration(self):
#         """Returns the chosen configuration."""
#         config = [self.psf, self.dcd]
#         return config
# 
#     @staticmethod
#     def getConfig(parent=None):
#         """Static method to create the dialog and return (date, time, accepted)."""
#         dialog = TopoTrajLoaderDialog(parent)
#         result = dialog.exec_()
#         config = dialog.configuration()
#         return config, result == QDialog.Accepted


from socket import *
from pkg_resources import resource_filename as res
from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton, QLineEdit
from PyQt5 import QtCore
from .Dialogues import TopoTrajLoaderDialog
from ..core.Biochemistry import *
import subprocess
        # self.fancyVisButton.clicked.connect(self.fancy_vis)
        # self.grid.addWidget(self.fancyVisButton, 2, 2)
        # self.fancyVisButton.setEnabled(True)
        self.sel1 = ""
        self.sel2 = ""
        self.filteredContactList = []

        # just for testing purposes
        # self.commandButton = QPushButton("Send command")
        # self.commandButton.clicked.connect(self.sendCommand)
        # self.grid.addWidget(self.commandButton, 4, 0)
        # self.commandButton.setEnabled(False)

        # self.commandField = QLineEdit()
        # self.grid.addWidget(self.commandField, 1, 0, 1, 2)
        self.vmd = VMDTcp()

    def addRep(self, txt):
        self.representations.append(txt)

    def prepareVMDWithTopoTraj(self, top, traj):
        self.vmd.send_command("mol new %s" % top)
        self.vmd.send_command(self.vmd.commands.removeReps(0))
        self.vmd.send_command("mol addfile %s waitfor all" % traj)
        self.vmd.send_command(self.vmd.commands.styleBackbone())
        self.vmd.send_command(self.vmd.commands.resetView())
        self.vmd.send_command(self.vmd.commands.gotoFrame(0))
        self.addRep("initialBB")

    def loadTopoTraj(self):

# Path: PyContact/gui/Dialogues.py
# class TopoTrajLoaderDialog(QDialog):
#     """Dialog to load the topology and trajectory file."""
#     def __init__(self, parent=None):
#         super(TopoTrajLoaderDialog, self).__init__(parent)
#         self.setWindowTitle("Load Data")
#         self.psf = ""
#         self.dcd = ""
# 
#         grid = QGridLayout(self)
# 
#         buttonPsf = QPushButton("Topology")
#         buttonPsf.clicked.connect(self.pick_psf)
# 
#         buttonDcd = QPushButton("Trajectory")
#         buttonDcd.clicked.connect(self.pick_dcd)
# 
#         helpButton = HelpButton()
# 
#         grid.addWidget(buttonPsf, 0, 0)
#         grid.addWidget(buttonDcd, 0, 1)
#         buttons = QDialogButtonBox(
#             QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
#             Qt.Horizontal, self)
#         buttons.accepted.connect(self.accept)
#         buttons.rejected.connect(self.reject)
#         grid.addWidget(buttons, 1, 0)
#         grid.addWidget(helpButton, 2, 0)
# 
#     def pick_psf(self):
#         """Pick the topology file."""
#         psfname = QFileDialog.getOpenFileNames(self, "Open topology")
#         for file in psfname[0]:
#             self.psf = file
#             break
# 
#     def pick_dcd(self):
#         """Pick the trajectory file."""
#         dcdname = QFileDialog.getOpenFileNames(self, "Open trajectory")
#         for file in dcdname[0]:
#             self.dcd = file
#             break
# 
#     def configuration(self):
#         """Returns the chosen configuration."""
#         config = [self.psf, self.dcd]
#         return config
# 
#     @staticmethod
#     def getConfig(parent=None):
#         """Static method to create the dialog and return (date, time, accepted)."""
#         dialog = TopoTrajLoaderDialog(parent)
#         result = dialog.exec_()
#         config = dialog.configuration()
#         return config, result == QDialog.Accepted


# Path: PyContact/gui/VMDControlPanel.py
from socket import *
from pkg_resources import resource_filename as res
from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton, QLineEdit
from PyQt5 import QtCore
from .Dialogues import TopoTrajLoaderDialog
from ..core.Biochemistry import *
import subprocess

        # self.fancyVisButton.clicked.connect(self.fancy_vis)
        # self.grid.addWidget(self.fancyVisButton, 2, 2)
        # self.fancyVisButton.setEnabled(True)
        self.sel1 = ""
        self.sel2 = ""
        self.filteredContactList = []

        # just for testing purposes
        # self.commandButton = QPushButton("Send command")
        # self.commandButton.clicked.connect(self.sendCommand)
        # self.grid.addWidget(self.commandButton, 4, 0)
        # self.commandButton.setEnabled(False)

        # self.commandField = QLineEdit()
        # self.grid.addWidget(self.commandField, 1, 0, 1, 2)
        self.vmd = VMDTcp()

    def addRep(self, txt):
        self.representations.append(txt)

    def prepareVMDWithTopoTraj(self, top, traj):
        self.vmd.send_command("mol new %s" % top)
        self.vmd.send_command(self.vmd.commands.removeReps(0))
        self.vmd.send_command("mol addfile %s waitfor all" % traj)
        self.vmd.send_command(self.vmd.commands.styleBackbone())
        self.vmd.send_command(self.vmd.commands.resetView())
        self.vmd.send_command(self.vmd.commands.gotoFrame(0))
        self.addRep("initialBB")

    def loadTopoTraj(self):

        topoloader = TopoTrajLoaderDialog()