Ejemplo n.º 1
0
	def _setPageClass(self, val):
		if isinstance(val, str):
			from dabo.lib.DesignerClassConverter import DesignerClassConverter
			conv = DesignerClassConverter()
			self._pageClass = conv.classFromText(val)
		elif issubclass(val, (dPage, dPanel)):
			self._pageClass = val
Ejemplo n.º 2
0
	def insertPage(self, pos, pgCls=None, makeActive=False, ignoreOverride=False):
		"""
		Inserts the page into the pageframe at the specified position,
		and makes it the active (displayed) page if makeActive is True.
		"""
		# Allow subclasses to potentially override this behavior. This will
		# enable them to handle page creation in their own way. If overridden,
		# the method will return the new page.
		ret = None
		if not ignoreOverride:
			ret = self._insertPageOverride(pos, pgCls, makeActive)
		if ret:
			return ret
		if pgCls is None:
			pgCls = self.PageClass
		if self.Sizer is None:
			self.Sizer = dabo.ui.dSizer()
		if isinstance(pgCls, dPage):
			pg = pgCls
		else:
			# See if the 'pgCls' is either some XML or the path of an XML file
			if isinstance(pgCls, str):
				xml = pgCls
				from dabo.lib.DesignerClassConverter import DesignerClassConverter
				conv = DesignerClassConverter()
				pgCls = conv.classFromText(xml)
			pg = pgCls(self)
		self.Sizer.insert(pos, pg, 1, "x")
		self._pages.insert(pos, pg)
		self.layout()
		if makeActive or (self.PageCount == 1):
			self.showPage(pg)
		else:
			self.showPage(self.SelectedPage)
		return self.Pages[pos]
Ejemplo n.º 3
0
Archivo: Wizard.py Proyecto: xfxf/dabo
	def insert(self, pos, pg):
		if isinstance(pg, (list, tuple)):
			pg.reverse()
			ret = []
			for p in pg:
				ret.append(self.insert(pos, p))
		else:
			# Give subclasses a chance to override
			page = self._insertWizardPageOverride(pos, pg)
			if page is None:
				if isinstance(pg, WizardPage):
					# Already instantiated. First make sure it is a child of
					# the page panel
					if pg.Parent is not self.pagePanel:
						pg.changeParent(self.pagePanel)
					page = pg
				else:
					if isinstance(pg, basestring):
						xml = pg
						from dabo.lib.DesignerClassConverter import DesignerClassConverter
						conv = DesignerClassConverter()
						pg = conv.classFromText(xml)
					page = pg(self.pagePanel)
				page.Size = self.pagePanel.Size
				self._pages.insert(pos, page)
				page.Visible = False
			ret = page
		return ret
Ejemplo n.º 4
0
	def insertPage(self, pos, pgCls=None, makeActive=False, ignoreOverride=False):
		"""
		Inserts the page into the pageframe at the specified position,
		and makes it the active (displayed) page if makeActive is True.
		"""
		# Allow subclasses to potentially override this behavior. This will
		# enable them to handle page creation in their own way. If overridden,
		# the method will return the new page.
		ret = None
		if not ignoreOverride:
			ret = self._insertPageOverride(pos, pgCls, makeActive)
		if ret:
			return ret
		if pgCls is None:
			pgCls = self.PageClass
		if self.Sizer is None:
			self.Sizer = dabo.ui.dSizer()
		if isinstance(pgCls, dPage):
			pg = pgCls
		else:
			# See if the 'pgCls' is either some XML or the path of an XML file
			if isinstance(pgCls, basestring):
				xml = pgCls
				from dabo.lib.DesignerClassConverter import DesignerClassConverter
				conv = DesignerClassConverter()
				pgCls = conv.classFromText(xml)
			pg = pgCls(self)
		self.Sizer.insert(pos, pg, 1, "x")
		self._pages.insert(pos, pg)
		self.layout()
		if makeActive or (self.PageCount == 1):
			self.showPage(pg)
		else:
			self.showPage(self.SelectedPage)
		return self.Pages[pos]
Ejemplo n.º 5
0
	def _setPageClass(self, val):
		if isinstance(val, basestring):
			from dabo.lib.DesignerClassConverter import DesignerClassConverter
			conv = DesignerClassConverter()
			self._pageClass = conv.classFromText(val)
		elif issubclass(val, (dPage, dPanel)):
			self._pageClass = val
Ejemplo n.º 6
0
    def insertPage(self,
                   pos,
                   pgCls=None,
                   caption="",
                   imgKey=None,
                   ignoreOverride=False,
                   **kwargs):
        """
		Insert the page into the pageframe at the specified position,
		and optionally sets the page caption and image. The image
		should have already been added to the pageframe if it is
		going to be set here.

		Any kwargs sent will be passed on to the constructor of the
		page class.
		"""
        # Allow subclasses to potentially override this behavior. This will
        # enable them to handle page creation in their own way. If overridden,
        # the method will return the new page.
        ret = None
        if not ignoreOverride:
            ret = self._insertPageOverride(pos, pgCls, caption, imgKey)
        if ret:
            return ret
        if pgCls is None:
            pgCls = self.PageClass
        if isinstance(pgCls, dPage):
            pg = pgCls
        else:
            # See if the 'pgCls' is either some XML or the path of an XML file
            if isinstance(pgCls, basestring):
                xml = pgCls
                from dabo.lib.DesignerClassConverter import DesignerClassConverter
                conv = DesignerClassConverter()
                pgCls = conv.classFromText(xml)
            pg = pgCls(self, **kwargs)
        if not caption:
            # Page could have its own default caption
            caption = pg._caption
        if caption.count("&") == 1 and caption[-1] != "&":
            hotkey = "alt+%s" % (caption[caption.index("&") + 1], )
            self.Form.bindKey(hotkey, self._onHK)
            pg._rawCaption = caption
            if sys.platform.startswith("darwin"):
                # Other platforms underline the character after the &; Mac just
                # shows the &.
                caption = caption.replace("&", "")
        if imgKey:
            idx = self._imageList[imgKey]
            self.InsertPage(pos, pg, text=caption, select=False, imageId=idx)
        else:
            self.InsertPage(pos, pg, text=caption, select=False)
        self.Pages[pos].imgKey = imgKey
        self.layout()
        insertedPage = self.Pages[pos]
        insertedPage.Caption = caption
        return insertedPage
Ejemplo n.º 7
0
	def insertPage(self, pos, pgCls=None, caption="", imgKey=None,
			ignoreOverride=False, **kwargs):
		"""
		Insert the page into the pageframe at the specified position,
		and optionally sets the page caption and image. The image
		should have already been added to the pageframe if it is
		going to be set here.

		Any kwargs sent will be passed on to the constructor of the
		page class.
		"""
		# Allow subclasses to potentially override this behavior. This will
		# enable them to handle page creation in their own way. If overridden,
		# the method will return the new page.
		ret = None
		if not ignoreOverride:
			ret = self._insertPageOverride(pos, pgCls, caption, imgKey)
		if ret:
			return ret
		if pgCls is None:
			pgCls = self.PageClass
		if isinstance(pgCls, dPage):
			pg = pgCls
		else:
			# See if the 'pgCls' is either some XML or the path of an XML file
			if isinstance(pgCls, basestring):
				xml = pgCls
				from dabo.lib.DesignerClassConverter import DesignerClassConverter
				conv = DesignerClassConverter()
				pgCls = conv.classFromText(xml)
			pg = pgCls(self, **kwargs)
		if not caption:
			# Page could have its own default caption
			caption = pg._caption
		if caption.count("&") == 1 and caption[-1] != "&":
			hotkey = "alt+%s" % (caption[caption.index("&")+1],)
			self.Form.bindKey(hotkey, self._onHK)
			pg._rawCaption = caption
			if sys.platform.startswith("darwin"):
				# Other platforms underline the character after the &; Mac just
				# shows the &.
				caption = caption.replace("&", "")
		if imgKey:
			idx = self._imageList[imgKey]
			self.InsertPage(pos, pg, text=caption, select=False, imageId=idx)
		else:
			self.InsertPage(pos, pg, text=caption, select=False)
		self.Pages[pos].imgKey = imgKey
		self.layout()
		insertedPage = self.Pages[pos]
		insertedPage.Caption = caption
		return insertedPage
Ejemplo n.º 8
0
    def insertPage(self,
                   pos,
                   pgCls=None,
                   caption="",
                   imgKey=None,
                   ignoreOverride=False):
        """
		Insert the page into the pageframe at the specified position,
		and optionally sets the page caption and image. The image
		should have already been added to the pageframe if it is
		going to be set here.
		"""
        # Allow subclasses to potentially override this behavior. This will
        # enable them to handle page creation in their own way. If overridden,
        # the method will return the new page.
        ret = None
        if not ignoreOverride:
            ret = self._insertPageOverride(pos, pgCls, caption, imgKey)
        if ret:
            return ret
        if pgCls is None:
            pgCls = self.PageClass
        if isinstance(pgCls, dabo.ui.dPage):
            pg = pgCls
        else:
            # See if the 'pgCls' is either some XML or the path of an XML file
            if isinstance(pgCls, basestring):
                xml = pgCls
                from dabo.lib.DesignerClassConverter import DesignerClassConverter
                conv = DesignerClassConverter()
                pgCls = conv.classFromText(xml)
            pg = pgCls(self)
        if not caption:
            # Page could have its own default caption
            caption = pg._caption
        if imgKey:
            idx = self._imageList[imgKey]
            bmp = self.GetImageList().GetBitmap(idx)
            self.InsertPage(pos, pg, caption=caption, bitmap=bmp)
        else:
            self.InsertPage(pos, pg, caption=caption)
        self.layout()
        return self.Pages[pos]
Ejemplo n.º 9
0
	def insertPage(self, pos, pgCls=None, caption="", imgKey=None,
			ignoreOverride=False):
		"""
		Insert the page into the pageframe at the specified position,
		and optionally sets the page caption and image. The image
		should have already been added to the pageframe if it is
		going to be set here.
		"""
		# Allow subclasses to potentially override this behavior. This will
		# enable them to handle page creation in their own way. If overridden,
		# the method will return the new page.
		ret = None
		if not ignoreOverride:
			ret = self._insertPageOverride(pos, pgCls, caption, imgKey)
		if ret:
			return ret
		if pgCls is None:
			pgCls = self.PageClass
		if isinstance(pgCls, dabo.ui.dPage):
			pg = pgCls
		else:
			# See if the 'pgCls' is either some XML or the path of an XML file
			if isinstance(pgCls, str):
				xml = pgCls
				from dabo.lib.DesignerClassConverter import DesignerClassConverter
				conv = DesignerClassConverter()
				pgCls = conv.classFromText(xml)
			pg = pgCls(self)
		if not caption:
			# Page could have its own default caption
			caption = pg._caption
		if imgKey:
			idx = self._imageList[imgKey]
			bmp = self.GetImageList().GetBitmap(idx)
			self.InsertPage(pos, pg, caption=caption, bitmap=bmp)
		else:
			self.InsertPage(pos, pg, caption=caption)
		self.layout()
		return self.Pages[pos]