[Help/Request] BTS Horizontal scrolling CvCivicsScreen.py

Drakart

Chieftain
Joined
Nov 14, 2007
Messages
7
Hi, is sometimes I start modding CIV4, I plan a lot of my “reinventing the wheel ” mod. I find this forum very helpful, and many times I wish to post a request or ask for help. I know how to merge other files in the SDK, I know how to fix some screens I have to fix, but I don’t know C++ or Pyton.
I search a lot to find an Horizontal scrolling Civics Screen … I see the one in the VISA but It was for Warlords and so no chance for me to correctly running it.

So I try to do it from myself without Python knowledge.



I can see:


In def interfaceScreen
screen.addScrollPanel(xxx, yyy, zzz)
screen.setActivation(xxx, yyy, zzz)


In def drawAllButtons

screen.attachPanelAt(xxx, yyy, zzz)



After some tries I have a civics screen with the scroll panel, but without other objects. This is a bit frustrating , so:
Can someone say how to add a simply scrollbar to the screen?
Or maybe… can someone make a normal CvCivicsScreen with only the horizontal scroolbar…

Fixing the font to 1 and width to 137 I can have 10 civics options … sorry but I nedd 11 and I want 200 width to allow long names.


Thanks for your attention and time.
 
Sorry for the UP, but i'm really in troubles...

I post here some NOT WORKING code, if some one could find errors in it make me happy...

Post an update were the techtoppannel correcly scrolling have now a big problem with the the help text....

Code:
	def interfaceScreen (self):
	
		#
		#OLD CODE HERE
		#
	
		# Make the scrollable area for the civics list...
		screen.addScrollPanel( "CivicList", u"", 1, 1, self.W_SCREEN, self.H_SCREEN - 78, PanelStyles.PANEL_STYLE_EXTERNAL )
		screen.setActivation( "CivicList", ActivationTypes.ACTIVATE_NORMAL )
		
	





	def drawAllButtons(self):				
	
		for i in range(gc.getNumCivicOptionInfos()):
		
			fX = self.HEADINGS_SPACING  + (self.HEADINGS_WIDTH + self.HEADINGS_SPACING) * i
			fY = self.HEADINGS_TOP
			szAreaID = self.AREA_NAME + str(i)
			screen = self.getScreen()
			screen.attachPanelAt( "CivicList", szAreaID, u"", u"", True, True, PanelStyles.PANEL_STYLE_MAIN, fX, fY, self.HEADINGS_WIDTH, self.HEADINGS_BOTTOM - self.HEADINGS_TOP, WidgetTypes.WIDGET_GENERAL, i, -1 )
			#screen.setLabel("", "Background",  self.OPTION_TITLE_SIZE + gc.getCivicOptionInfo(i).getDescription().upper() + u"</font>", CvUtil.FONT_CENTER_JUSTIFY, fX + self.HEADINGS_WIDTH/2, self.HEADINGS_TOP + self.TEXT_MARGIN, 0, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
			
			# draw the civic category(government, labor, ...)
			szCivicID = "CivicID" + str(i)
			screen.setTextAt( szCivicID, "CivicList", u"<font=4>" + gc.getCivicOptionInfo(i).getDescription().upper() + u"</font>", CvUtil.FONT_CENTER_JUSTIFY, fX, fY, 0, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, i, -1 )
			screen.setActivation( szCivicID, ActivationTypes.ACTIVATE_MIMICPARENTFOCUS)
			
			
			fY += self.TEXT_MARGIN
			
			for j in range(gc.getNumCivicInfos()):
				if (gc.getCivicInfo(j).getCivicOptionType() == i):										
					
					screen.addCheckBoxGFCAt("CivicList", self.getCivicsButtonName(j), gc.getCivicInfo(j).getButton(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), fX + self.BUTTON_SIZE/2, fY, self.BUTTON_SIZE, self.BUTTON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL, False)
					screen.setActivation( self.getCivicsButtonName(j), ActivationTypes.ACTIVATE_NORMAL )
					screen.hide (self.getCivicsButtonName(j) )
					
					# draw the civic names
					screen.setTextAt( self.getCivicsTextName(j), "CivicList", u"<font=3>" + gc.getCivicInfo(j).getDescription() + u"</font>", CvUtil.FONT_LEFT_JUSTIFY, fX + self.BUTTON_SIZE + self.TEXT_MARGIN, fY, 0, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )

					# make sure the next line is put down under the previous
					fY += 2 * self.TEXT_MARGIN + 1
					
					
			self.drawCivicOptionButtons(i)



			
	

def drawHelpText(self, iCivicOption):
#
#OLD code
#
		
		screen.setImageButtonAt(szHelpImageID, "CivicList", gc.getCivicInfo(iCivic).getButton(), fX + self.HEADINGS_WIDTH/2 - self.BIG_BUTTON_SIZE/2, fY, self.BIG_BUTTON_SIZE, self.BIG_BUTTON_SIZE, WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIVIC, iCivic, 1)




		
		def drawAllHelpText(self):
		for i in range (gc.getNumCivicOptionInfos()):		

			fX = self.HEADINGS_SPACING  + (self.HEADINGS_WIDTH + self.HEADINGS_SPACING) * i

			szPaneID = "CivicsHelpTextBackground" + str(i)
			screen = self.getScreen()
			screen.attachPanelAt( "CivicList", szPaneID, u"", u"", True, True, PanelStyles.PANEL_STYLE_MAIN, fX, self.HELP_TOP, self.HEADINGS_WIDTH, self.HELP_BOTTOM - self.HELP_TOP, WidgetTypes.WIDGET_GENERAL, i, -1)

			self.drawHelpText(i)


Also, ther is other that I need to see and change?
I think its not so difficult to make, with a bit of knowlege or experiences...
 
I make a new post and add a civcs screen , value like spacing or font ar not fixed at this time....

I have a problem to display the help text...

I think it was controlled in def drawHelpText
At
Code:
fY = self.HELP_TOP + 3 * self.TEXT_MARGIN
		szHelpAreaID = self.HELP_AREA_NAME + str(iCivicOption)		
		screen.addMultilineText(szHelpAreaID, self.HELP_TEXT_SIZE + szHelpText, fX+5, fY, self.HEADINGS_WIDTH-7, self.HELP_BOTTOM - fY-2, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)

addMultilineTextAt seems not exist... addTextAt seems not working....

I add the files here i someone need it to correctly display the help text...
 

Attachments

And there is also a 10-civics screen with no scrolling... :) (Not available yet, but it will be one day. :))
 
The problema is that the vertical one or the Visa need to merge the sdk... it seems impossible to think that we cannot do a python only screen...

In the pedia (take a look at CvPediaCivilization.py) to attach a multiline text to a pannel they have used this:

screen.attachMultilineText


But it does not work when the pannel is also attached to a scrolling one...

also i'm in trouble to attach the help directy to the scrolling pannel "civicsscreen"...

Now i made some testing on some non scrolling or half scrolling [the help is fixed] its work , but is not that i want...
If we can't found a solution i will take a look at the sdk... but this means that a mood to use it requires also a dll ... is not good: in my original idea i want a python only one...
...and I can't understood why this simply functions does not exist [I want to think i use it wrong...]
 
Back
Top Bottom