Example #1
0
class EnvironmentWidget(QtGui.QWidget, PropertyTreeNode, Ui_Environment):
    """Environment variables"""
    NAMESPACE = ""
    TITLE = "Enviroment Variables"
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)
        PropertyTreeNode.__init__(self, "environment")
        self.setupUi(self)
        self.setupVariablesTableModel()
        self.project = None

    def acceptFileSystemItem(self, fileSystemItem):
        return fileSystemItem.isproject
    
    def edit(self, project):
        self.project = project
        self.model.clear()
        self.model.addGroup('user', self.project.shellVariables, editable = True, checkable=True, foreground=QtCore.Qt.blue)
        self.model.addGroup('project', self.project.environment())
        self.model.addGroup('prymatex', self.application.supportManager.buildEnvironment(systemEnvironment = False), visible = False)

    def setupVariablesTableModel(self):
        self.model = EnvironmentTableModel(self)
        self.model.variablesChanged.connect(self.on_variablesModel_variablesChanged)
        self.tableView.setModel(self.model)
        
        self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.model.rowsInserted.connect(self.tableView.resizeRowsToContents)
        self.model.rowsRemoved.connect(self.tableView.resizeRowsToContents)
        self.tableView.resizeRowsToContents()
        
        self.checkBox1.setText("User")
        self.checkBox1.setChecked(True)
        self.checkBox2.setText("Project")
        self.checkBox2.setChecked(True)
        self.checkBox3.setText("Prymatex")
        
    @QtCore.pyqtSlot(bool)
    def on_checkBox1_clicked(self, checked):
        self.model.setVisibility('user', checked)

    @QtCore.pyqtSlot(bool)        
    def on_checkBox2_clicked(self, checked):
        self.model.setVisibility('project', checked)
    
    @QtCore.pyqtSlot(bool)        
    def on_checkBox3_clicked(self, checked):
        self.model.setVisibility('prymatex', checked)
        
    def on_variablesModel_variablesChanged(self, group, variables):
        self.application.projectManager.updateProject(self.project, shellVariables = variables)

    def on_pushAdd_pressed(self):
        self.model.insertVariable()
        
    def on_pushRemove_pressed(self):
        index = self.tableView.currentIndex()
        self.model.removeRows(index.row() , 1)
Example #2
0
class PMXEnvVariablesWidget(QtGui.QWidget, SettingsTreeNode, Ui_Environment):
    """Environment variables
    """
    NAMESPACE = "general"
    TITLE = "Enviroment Variables"
    ICON = resources.getIcon("code-variable")
    
    def __init__(self, settingGroup, parent = None):
        QtGui.QWidget.__init__(self, parent)
        SettingsTreeNode.__init__(self, "environment", settingGroup)
        self.setupUi(self)
        self.setupVariablesTableModel()
    
    def loadSettings(self):
        self.model.addGroup('user', self.application.supportManager.shellVariables, editable = True, checkable=True, foreground=QtCore.Qt.blue)
        self.model.addGroup('prymatex', self.application.supportManager.environment)
        self.model.addGroup('system', os.environ, foreground=QtCore.Qt.red, visible = False)

    def setupVariablesTableModel(self):
        self.model = EnvironmentTableModel(self)
        self.model.variablesChanged.connect(self.on_variablesModel_userVariablesChanged)
        self.tableView.setModel(self.model)
        
        self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.model.rowsInserted.connect(self.tableView.resizeRowsToContents)
        self.model.rowsRemoved.connect(self.tableView.resizeRowsToContents)
        self.tableView.resizeRowsToContents()
        
        self.checkBox1.setText("User")
        self.checkBox1.setChecked(True)
        self.checkBox2.setText("Prymatex")
        self.checkBox2.setChecked(True)
        self.checkBox3.setText("System")

    @QtCore.pyqtSlot(bool)
    def on_checkBox1_clicked(self, checked):
        self.model.setVisibility('user', checked)

    @QtCore.pyqtSlot(bool)        
    def on_checkBox2_clicked(self, checked):
        self.model.setVisibility('prymatex', checked)
    
    @QtCore.pyqtSlot(bool)
    def on_checkBox3_clicked(self, checked):
        self.model.setVisibility('system', checked)
        
    def on_variablesModel_userVariablesChanged(self, group, variables):
        self.settingGroup.setValue('shellVariables', variables)

    def on_pushAdd_pressed(self):
        self.model.insertVariable()
        
    def on_pushRemove_pressed(self):
        index = self.tableView.currentIndex()
        self.model.removeRows(index.row() , 1)
Example #3
0
class EnvironmentWidget(QtGui.QWidget, Ui_Environment):
    """Environment variables"""
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setupUi(self)
        self.setupVariablesTableModel()

    def setupVariablesTableModel(self):
        self.model = EnvironmentTableModel(self)
        self.model.variablesChanged.connect(
            self.on_variablesModel_variablesChanged)
        self.tableView.setModel(self.model)

        self.tableView.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.tableView.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.model.rowsInserted.connect(self.tableView.resizeRowsToContents)
        self.model.rowsRemoved.connect(self.tableView.resizeRowsToContents)
        self.tableView.resizeRowsToContents()

        self.checkBox1.setText("User")
        self.checkBox1.setChecked(True)
        self.checkBox2.setText("Project")
        self.checkBox2.setChecked(True)
        self.checkBox3.setText("Prymatex")

    @QtCore.pyqtSlot(bool)
    def on_checkBox1_clicked(self, checked):
        self.model.setVisibility('user', checked)

    @QtCore.pyqtSlot(bool)
    def on_checkBox2_clicked(self, checked):
        self.model.setVisibility('template', checked)

    @QtCore.pyqtSlot(bool)
    def on_checkBox3_clicked(self, checked):
        self.model.setVisibility('prymatex', checked)

    def on_variablesModel_variablesChanged(self, group, variables):
        print group, variables

    def on_pushAdd_pressed(self):
        self.model.insertVariable()

    def on_pushRemove_pressed(self):
        index = self.tableView.currentIndex()
        self.model.removeRows(index.row(), 1)
Example #4
0
 def setupVariablesTableModel(self):
     self.model = EnvironmentTableModel(self)
     self.model.variablesChanged.connect(self.on_variablesModel_variablesChanged)
     self.tableView.setModel(self.model)
     
     self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
     self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
     self.tableView.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
     self.model.rowsInserted.connect(self.tableView.resizeRowsToContents)
     self.model.rowsRemoved.connect(self.tableView.resizeRowsToContents)
     self.tableView.resizeRowsToContents()
     
     self.checkBox1.setText("User")
     self.checkBox1.setChecked(True)
     self.checkBox2.setText("Project")
     self.checkBox2.setChecked(True)
     self.checkBox3.setText("Prymatex")
Example #5
0
class EnvironmentWidget(QtGui.QWidget, Ui_Environment):
    """Environment variables"""
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)
        self.setupUi(self)
        self.setupVariablesTableModel()

    def setupVariablesTableModel(self):
        self.model = EnvironmentTableModel(self)
        self.model.variablesChanged.connect(self.on_variablesModel_variablesChanged)
        self.tableView.setModel(self.model)
        
        self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        self.tableView.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.model.rowsInserted.connect(self.tableView.resizeRowsToContents)
        self.model.rowsRemoved.connect(self.tableView.resizeRowsToContents)
        self.tableView.resizeRowsToContents()
        
        self.checkBox1.setText("User")
        self.checkBox1.setChecked(True)
        self.checkBox2.setText("Project")
        self.checkBox2.setChecked(True)
        self.checkBox3.setText("Prymatex")

    @QtCore.pyqtSlot(bool)
    def on_checkBox1_clicked(self, checked):
        self.model.setVisibility('user', checked)

    @QtCore.pyqtSlot(bool)        
    def on_checkBox2_clicked(self, checked):
        self.model.setVisibility('template', checked)
    
    @QtCore.pyqtSlot(bool)        
    def on_checkBox3_clicked(self, checked):
        self.model.setVisibility('prymatex', checked)
        
    def on_variablesModel_variablesChanged(self, group, variables):
        print group, variables

    def on_pushAdd_pressed(self):
        self.model.insertVariable()
        
    def on_pushRemove_pressed(self):
        index = self.tableView.currentIndex()
        self.model.removeRows(index.row() , 1)
Example #6
0
class PMXEnvVariablesWidget(QtGui.QWidget, SettingsTreeNode, Ui_Environment):
    """Environment variables
    """
    NAMESPACE = "general"
    TITLE = "Enviroment Variables"
    ICON = resources.getIcon("code-variable")

    def __init__(self, settingGroup, parent=None):
        QtGui.QWidget.__init__(self, parent)
        SettingsTreeNode.__init__(self, "environment", settingGroup)
        self.setupUi(self)
        self.setupVariablesTableModel()

    def loadSettings(self):
        self.model.addGroup('user',
                            self.application.supportManager.shellVariables,
                            editable=True,
                            checkable=True,
                            foreground=QtCore.Qt.blue)
        self.model.addGroup('prymatex',
                            self.application.supportManager.environment)
        self.model.addGroup('system',
                            os.environ,
                            foreground=QtCore.Qt.red,
                            visible=False)

    def setupVariablesTableModel(self):
        self.model = EnvironmentTableModel(self)
        self.model.variablesChanged.connect(
            self.on_variablesModel_userVariablesChanged)
        self.tableView.setModel(self.model)

        self.tableView.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.tableView.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.model.rowsInserted.connect(self.tableView.resizeRowsToContents)
        self.model.rowsRemoved.connect(self.tableView.resizeRowsToContents)
        self.tableView.resizeRowsToContents()

        self.checkBox1.setText("User")
        self.checkBox1.setChecked(True)
        self.checkBox2.setText("Prymatex")
        self.checkBox2.setChecked(True)
        self.checkBox3.setText("System")

    @QtCore.pyqtSlot(bool)
    def on_checkBox1_clicked(self, checked):
        self.model.setVisibility('user', checked)

    @QtCore.pyqtSlot(bool)
    def on_checkBox2_clicked(self, checked):
        self.model.setVisibility('prymatex', checked)

    @QtCore.pyqtSlot(bool)
    def on_checkBox3_clicked(self, checked):
        self.model.setVisibility('system', checked)

    def on_variablesModel_userVariablesChanged(self, group, variables):
        self.settingGroup.setValue('shellVariables', variables)

    def on_pushAdd_pressed(self):
        self.model.insertVariable()

    def on_pushRemove_pressed(self):
        index = self.tableView.currentIndex()
        self.model.removeRows(index.row(), 1)