Esempio n. 1
0
    def __init__(self, main_window, start=False):

        """
		Constructor

		Arguments:
		main_window -- a the main ui
		
		Keyword arguments:
		start -- indicates whether the widget is opened because OpenSesame has
				 started (True) or because the new button has been clicked
				 (False) (default=True)
		"""

        QtGui.QDialog.__init__(self, main_window)

        self.main_window = main_window
        self.ui = Ui_widget_start_new()
        self.ui.setupUi(self)
        self.ui.widget_credits.initialize(self.main_window)
        self.main_window.theme.apply_theme(self)
        if start:
            self.tab_name = "__start_wizard__"
        else:
            self.tab_name = "__new_wizard__"

            # Initialize templates
        for path, desc in template_info.templates:
            try:
                path = self.main_window.experiment.resource(path)
            except:
                continue
            item = QtGui.QListWidgetItem(self.ui.list_templates)
            item.setText(desc)
            item.file = path
            item.setIcon(self.main_window.experiment.icon("wizard"))
            self.ui.list_templates.addItem(item)
        self.ui.list_templates.setCurrentRow(0)
        self.ui.list_templates.itemDoubleClicked.connect(self.open_template)

        # Initialize recent
        if len(self.main_window.recent_files) == 0:
            self.ui.list_recent.hide()
            self.ui._label_recent.hide()
        else:
            for f in self.main_window.recent_files:
                item = QtGui.QListWidgetItem(self.ui.list_recent)
                item.setText(os.path.basename(f))
                item.file = f
                item.setIcon(self.main_window.experiment.icon("experiment"))
            self.ui.list_recent.setCurrentRow(0)
            self.ui.list_recent.itemDoubleClicked.connect(self.open_recent)

            # Connect buttons
        self.ui.button_browse.clicked.connect(self.main_window.open_file)
        self.ui.button_osdoc.clicked.connect(self.main_window.ui.tabwidget.open_osdoc)
        self.ui.button_forum.clicked.connect(self.main_window.ui.tabwidget.open_forum)
        self.ui.button_cancel.clicked.connect(self.cancel)

        # Show the correct header
        if start:
            self.ui.widget_header_new.hide()
        else:
            self.ui.widget_header_start.hide()
Esempio n. 2
0
    def __init__(self, main_window, start=False):
        """
		Constructor

		Arguments:
		main_window -- a the main ui
		
		Keyword arguments:
		start -- indicates whether the widget is opened because OpenSesame has
				 started (True) or because the new button has been clicked
				 (False) (default=True)
		"""

        QtGui.QDialog.__init__(self, main_window)

        self.main_window = main_window
        self.ui = Ui_widget_start_new()
        self.ui.setupUi(self)
        self.ui.widget_credits.initialize(self.main_window)
        self.main_window.theme.apply_theme(self)
        if start:
            self.tab_name = '__start_wizard__'
        else:
            self.tab_name = '__new_wizard__'

        # Initialize templates
        for path, desc in template_info.templates:
            try:
                path = self.main_window.experiment.resource(path)
            except:
                continue
            item = QtGui.QListWidgetItem(self.ui.list_templates)
            item.setText(desc)
            item.file = path
            item.setIcon(self.main_window.experiment.icon("wizard"))
            self.ui.list_templates.addItem(item)
        self.ui.list_templates.setCurrentRow(0)
        self.ui.list_templates.itemDoubleClicked.connect(self.open_template)

        # Initialize recent
        if len(self.main_window.recent_files) == 0:
            self.ui.list_recent.hide()
            self.ui._label_recent.hide()
        else:
            for f in self.main_window.recent_files:
                item = QtGui.QListWidgetItem(self.ui.list_recent)
                item.setText(os.path.basename(f))
                item.file = f
                item.setIcon(self.main_window.experiment.icon("experiment"))
            self.ui.list_recent.setCurrentRow(0)
            self.ui.list_recent.itemDoubleClicked.connect(self.open_recent)

        # Connect buttons
        self.ui.button_browse.clicked.connect(self.main_window.open_file)
        self.ui.button_osdoc.clicked.connect( \
         self.main_window.ui.tabwidget.open_osdoc)
        self.ui.button_forum.clicked.connect( \
         self.main_window.ui.tabwidget.open_forum)
        self.ui.button_cancel.clicked.connect(self.cancel)

        # Show the correct header
        if start:
            self.ui.widget_header_new.hide()
        else:
            self.ui.widget_header_start.hide()
Esempio n. 3
0
	def __init__(self, main_window, start=False):

		"""
		Constructor

		Arguments:
		main_window -- a the main ui
		
		Keyword arguments:
		start -- indicates whether the widget is opened because OpenSesame has
				 started (True) or because the new button has been clicked
				 (False) (default=True)
		"""

		QtGui.QDialog.__init__(self, main_window)

		self.main_window = main_window
		self.ui = Ui_widget_start_new()
		self.ui.setupUi(self)
		self.ui.widget_credits.initialize(self.main_window)
		self.main_window.theme.apply_theme(self)
		if start:
			self.tab_name = '__start_wizard__'
		else:
			self.tab_name = '__new_wizard__'

		# Initialize templates
		templates = (os.path.join("templates", "default.opensesame"), \
			"Default template"), (os.path.join("templates", \
			"extended_template.opensesame"), "Extended template"), \
			(os.path.join("templates", "eco_alt_template.opensesame.tar.gz"), \
			"Stimulus set: An ecological alternative to Snodgrass & Vanderwart")
		for f in templates:
			item = QtGui.QListWidgetItem(self.ui.list_templates)
			item.setText(f[1])
			item.file = self.main_window.experiment.resource(f[0])
			item.setIcon(self.main_window.experiment.icon("wizard"))
			self.ui.list_templates.addItem(item)
		self.ui.list_templates.setCurrentRow(0)
		self.ui.list_templates.itemDoubleClicked.connect(self.open_template)		

		# Initialize recent
		if len(self.main_window.recent_files) == 0:
			self.ui.list_recent.hide()
			self.ui._label_recent.hide()
		else:		
			for f in self.main_window.recent_files:
				item = QtGui.QListWidgetItem(self.ui.list_recent)
				item.setText(os.path.basename(f))
				item.file = f
				item.setIcon(self.main_window.experiment.icon("experiment"))
			self.ui.list_recent.setCurrentRow(0)	
			self.ui.list_recent.itemDoubleClicked.connect(self.open_recent)
		
		# Connect buttons
		self.ui.button_browse.clicked.connect(self.main_window.open_file)
		self.ui.button_osdoc.clicked.connect( \
			self.main_window.ui.tabwidget.open_osdoc)
		self.ui.button_forum.clicked.connect( \
			self.main_window.ui.tabwidget.open_forum)
		self.ui.button_cancel.clicked.connect(self.cancel)			
			
		# Show the correct header
		if start:
			self.ui.widget_header_new.hide()
		else:
			self.ui.widget_header_start.hide()