<commit_before>#!/usr/bin/python

from __future__ import division

import sys
import json
import os
import math
from copy import deepcopy

from optparse import OptionParser

from PySide import QtGui, QtUiTools, QtCore


class AddChannelDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        super(AddChannelDialog, self).__init__(parent=parent)
        self.setWindowTitle('Add Channel')
        formLayout = QtGui.QFormLayout()
        self.nameLineEdit = QtGui.QLineEdit()
        self.typeComboBox = QtGui.QComboBox()
        self.typeComboBox.addItems(['qubit','physical'])
        formLayout.addRow('Channel Name:', self.nameLineEdit)
        formLayout.addRow('Channel Type:', self.typeComboBox)

        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok  | QtGui.QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(formLayout)
        vbox.addWidget(self.buttonBox)
        
        self.setLayout(vbox)
        self.show()
        
class DeleteChannelDialog(QtGui.QDialog):
     def __init__(self, parent=None, channelNames=None):
        super(DeleteChannelDialog, self).__init__(parent=parent)
        self.setWindowTitle('Delete Channel')
        
        self.channelComboBox = QtGui.QComboBox()
        self.channelComboBox.addItems(channelNames)
        
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.channelComboBox)
        
        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok  | QtGui.QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 
        
        vbox.addWidget(self.buttonBox)
        
        self.setLayout(vbox)
        self.show()
   
    
class PulseParamGUI(object):
    _paramPath = ''
    _params = {}
    _emptyQubitParams = {'channelType':'logical', 'piAmp': 0, 'pi2Amp': 0, 'sigma': 0, 'delta': 0, 'pulseLength': 0, 'pulseType': 'drag', 'buffer': 4}
    _emptyChannelParams = {'channelType':'physical', 'bufferPadding': 0, 'bufferReset': 0, 'bufferDelay': 0, 'offset': 0, 'delay': 0, 'T': [[1,0],[0,1]], 'passThru': 1}
    _currentQubit = None
    _currentChannel = None
    
    def __init__(self, fileName=None):

        #It seems there should be some nicer way to do this so that we could still subclass QMainWindow
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile('pulseParamGUI.ui')
        file.open(QtCore.QFile.ReadOnly)<commit_msg>Minor bug fix to point to absolute path of UI file for PulseParamsGui. --CAR<commit_after>#!/usr/bin/python

from __future__ import division

import sys
import json
import os
import math
from copy import deepcopy

from optparse import OptionParser

from PySide import QtGui, QtUiTools, QtCore


class AddChannelDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        super(AddChannelDialog, self).__init__(parent=parent)
        self.setWindowTitle('Add Channel')
        formLayout = QtGui.QFormLayout()
        self.nameLineEdit = QtGui.QLineEdit()
        self.typeComboBox = QtGui.QComboBox()
        self.typeComboBox.addItems(['qubit','physical'])
        formLayout.addRow('Channel Name:', self.nameLineEdit)
        formLayout.addRow('Channel Type:', self.typeComboBox)

        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok  | QtGui.QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(formLayout)
        vbox.addWidget(self.buttonBox)
        
        self.setLayout(vbox)
        self.show()
        
class DeleteChannelDialog(QtGui.QDialog):
     def __init__(self, parent=None, channelNames=None):
        super(DeleteChannelDialog, self).__init__(parent=parent)
        self.setWindowTitle('Delete Channel')
        
        self.channelComboBox = QtGui.QComboBox()
        self.channelComboBox.addItems(channelNames)
        
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.channelComboBox)
        
        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok  | QtGui.QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 
        
        vbox.addWidget(self.buttonBox)
        
        self.setLayout(vbox)
        self.show()
   
    
class PulseParamGUI(object):
    _paramPath = ''
    _params = {}
    _emptyQubitParams = {'channelType':'logical', 'piAmp': 0, 'pi2Amp': 0, 'sigma': 0, 'delta': 0, 'pulseLength': 0, 'pulseType': 'drag', 'buffer': 4}
    _emptyChannelParams = {'channelType':'physical', 'bufferPadding': 0, 'bufferReset': 0, 'bufferDelay': 0, 'offset': 0, 'delay': 0, 'T': [[1,0],[0,1]], 'passThru': 1}
    _currentQubit = None
    _currentChannel = None
    
    def __init__(self, fileName=None):

        #It seems there should be some nicer way to do this so that we could still subclass QMainWindow
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile(os.path.join(os.path.dirname(sys.argv[0]), 'pulseParamGUI.ui'))
        file.open(QtCore.QFile.ReadOnly)
{'fraction_non_alphanumeric': 0.11629671789034339, 'fraction_numerical': 0.006640106241699867, 'mean_word_length': 3.1544523246650904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3010888', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1635, 'n_words': 313}