Changeset 57

Show
Ignore:
Timestamp:
02/28/2012 06:54:37 PM (2 years ago)
Author:
ecoughlan
Message:

Text wrapping had been implemented

Files:
12 modified

Legend:

Unmodified
Added
Removed
  • .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs

    r1 r57  
    1 #Mon Feb 06 19:37:54 PST 2012 
     1#Thu Feb 23 21:34:42 PST 2012 
    22eclipse.preferences.version=1 
    33tipsAndTricks=true 
    4 platformState=1327945504859 
     4platformState=1329723488701 
    55quickStart=false 
    66PROBLEMS_FILTERS_MIGRATE=true 
  • .metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml

    r1 r57  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<section name="Workbench"> 
     3    <section name="WorkbenchPreferenceDialogSettings"> 
     4        <item value="-45" key="DIALOG_Y_ORIGIN"/> 
     5        <item value="127" key="DIALOG_X_ORIGIN"/> 
     6    </section> 
    37    <section name="ImportExportAction"> 
    48    </section> 
  • .metadata/.plugins/org.eclipse.ui.workbench/workbench.xml

    r2 r57  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <workbench progressCount="8" version="2.0"> 
     2<workbench progressCount="32" version="2.0"> 
    33<workbenchAdvisor/> 
    4 <window height="768" width="1024" x="100" y="100"> 
     4<window height="768" maximized="true" width="1024" x="126" y="-7"> 
    55<fastViewData fastViewLocation="1024"/> 
    66<perspectiveBar> 
     
    1515<coolItem id="org.eclipse.jdt.ui.JavaElementCreationActionSet" itemType="typeToolBarContribution" x="76" y="22"/> 
    1616<coolItem id="org.eclipse.search.searchActionSet" itemType="typeToolBarContribution" x="53" y="22"/> 
     17<coolItem id="org.eclipse.ui.edit.text.actionSet.presentation" itemType="typeToolBarContribution" x="61" y="22"/> 
    1718<coolItem id="group.nav" itemType="typeGroupMarker"/> 
    1819<coolItem id="org.eclipse.ui.workbench.navigate" itemType="typeToolBarContribution" x="190" y="22"/> 
    1920<coolItem id="group.editor" itemType="typeGroupMarker"/> 
     21<coolItem id="org.python.pydev.editor.PythonEditor" itemType="typePlaceholder" x="-1" y="-1"/> 
     22<coolItem id="org.eclipse.ui.DefaultTextEditor" itemType="typePlaceholder" x="-1" y="-1"/> 
    2023<coolItem id="group.help" itemType="typeGroupMarker"/> 
    2124<coolItem id="org.eclipse.ui.workbench.help" itemType="typeToolBarContribution" x="-1" y="-1"/> 
     
    7881<view id="org.eclipse.jdt.ui.JavadocView" partName="Javadoc"/> 
    7982</views> 
    80 <perspectives activePart="org.python.pydev.navigator.view" activePerspective="org.python.pydev.ui.PythonPerspective"> 
     83<perspectives activePart="org.eclipse.ui.views.ProblemView" activePerspective="org.python.pydev.ui.PythonPerspective"> 
    8184<perspective editorAreaTrimState="2" editorAreaVisible="1" fixed="0" version="0.016"> 
    8285<descriptor class="org.eclipse.jdt.internal.ui.JavaPerspectiveFactory" id="org.eclipse.jdt.ui.JavaPerspective" label="Java"/> 
     
    268271</trimLayout> 
    269272</window> 
    270 <mruList/> 
     273<mruList> 
     274<file factoryID="org.eclipse.ui.ide.FileStoreEditorInputFactory" id="org.python.pydev.editor.PythonEditor" name="main.py" tooltip="C:\Users\Erin Coughlan\Documents\cs121sp2012_5\src\main.py"> 
     275<persistable uri="file:/C:/Users/Erin%20Coughlan/Documents/cs121sp2012_5/src/main.py"/> 
     276</file> 
     277<file factoryID="org.eclipse.ui.ide.FileStoreEditorInputFactory" id="org.eclipse.ui.DefaultTextEditor" name=".project" tooltip="C:\Users\Erin Coughlan\Documents\cs121sp2012_5\.project"> 
     278<persistable uri="file:/C:/Users/Erin%20Coughlan/Documents/cs121sp2012_5/.project"/> 
     279</file> 
     280</mruList> 
    271281</workbench> 
  • .metadata/.plugins/org.python.pydev/ping.log

    r2 r57  
    33plugin.started%5B%5D=1328854927462%3APydev_2.3.0.2011121518 
    44plugin.started%5B%5D=1328855693788%3APydev_2.3.0.2011121518 
     5plugin.started%5B%5D=1330061502564%3APydev_2.4.0.2012020116 
     6editor.opened%5B%5D=1330061548491%3APydevEditor_2.4.0.2012020116 
     7editor.opened%5B%5D=1330061648087%3APydevEditor_2.4.0.2012020116 
     8editor.opened%5B%5D=1330165561231%3APydevEditor_2.4.0.2012020116 
     9plugin.started%5B%5D=1330165574772%3APydev_2.4.0.2012020116 
  • .pydevproject

    r2 r57  
    44<pydev_project> 
    55<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> 
    6 <path>/mt</path> 
    7 <path>/mt/src</path> 
     6<path>/TechTrek</path> 
     7<path>/TechTrek/src</path> 
    88</pydev_pathproperty> 
    99<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> 
  • src/buildables.py

    r44 r57  
    2020train = Building('train', TRANSPORT, trainStats) 
    2121train.setMenuDescript("This is a train") 
    22 train.setDetailedDescript("This is a detailed description of a train.") 
     22train.setDetailedDescript("This is a very long descrption of a train.  \ 
     23It will use text wrapping  and will work and Erin will be happy.") 
    2324train.setImageFileName("train.jpg") 
    2425 
  • src/dimensions.py

    r56 r57  
    1919SCREEN_W = 1080 
    2020global SCREEN_H  
    21 SCREEN_H = 792 
     21#SCREEN_H = 792 
     22# Erin's Computer 
     23SCREEN_H = 600 
    2224#SCREEN_W = 1366 
    2325#SCREEN_H = 768 
  • src/main.py

    r56 r57  
    77 
    88import pygame, os, math 
    9 import pygame._view # something about pygame2exe... 
     9#import pygame._view # something about pygame2exe... 
    1010 
    1111from globals import * 
  • src/staticWindows.py

    r54 r57  
    55''' 
    66import pygame, os, math 
    7 import pygame._view # something about pygame2exe... 
     7#import pygame._view # something about pygame2exe... 
    88 
    99from globals import * 
  • src/text.py

    r56 r57  
    88from pygame.locals import * 
    99from globals import * 
     10from itertools import chain 
    1011 
    1112class Text: 
    12     def __init__(self, pos, text, size, color): 
     13    def __init__(self, pos, text, size, color, width=SCREEN_W): 
    1314        self.text = text 
    1415        self.size = size 
     
    1819        self.origSize = size 
    1920        self.origPos = pos 
     21        self.maxWidth = width 
    2022         
    2123    def render(self,surface): 
    22         surface.blit(self.font.render(self.text, True, self.color),pygame.Rect(self.left, self.top,0,0)) 
     24        wrapped = self.wrapLine() 
     25        for i in range(len(wrapped)): 
     26            surface.blit(self.font.render(wrapped[i], True, self.color), 
     27                         pygame.Rect(self.left, self.top+(self.size)*i,0,0)) 
    2328         
    2429    def resize(self,size): 
     
    3035        self.pos = (self.left,self.top) 
    3136        self.font = pygame.font.Font(None,self.size) 
    32          
    33          
     37        
     38     
     39    # adapted from http://pygame.org/wiki/TextWrapping     
     40    def truncLine(self, text): 
     41        """ Helper function for wrapLine """ 
     42        real=len(text)        
     43        stext=text            
     44        l=self.font.size(text)[0] 
     45        cut=0 
     46        a=0                   
     47        done=1 
     48        while l > self.maxWidth: 
     49            a=a+1 
     50            n=text.rsplit(None, a)[0] 
     51            if stext == n: 
     52                cut += 1 
     53                stext= n[:-cut] 
     54            else: 
     55                stext = n 
     56            l=self.font.size(stext)[0] 
     57            real=len(stext)                
     58            done=0                         
     59        return real, done, stext              
     60     
     61    # adapted from http://pygame.org/wiki/TextWrapping 
     62    def wrapLine(self):  
     63        """ Returns a list where each item is a line of text """ 
     64        done=0                       
     65        wrapped=[]  
     66        text = self.text                  
     67                                    
     68        while not done:              
     69            nl, done, stext=self.truncLine(text)  
     70            wrapped.append(stext.strip())                   
     71            text=text[nl:]                                  
     72        return wrapped 
  • src/turnMenu.py

    r54 r57  
    4949    def createDescription(self, name): 
    5050        print 'awefohias' 
    51         descriptionWindow = Window(name,506,200) 
     51        descriptionWindow = Window(name,526,300) 
    5252        descriptionWindow.setDefaultResponse(Response('windows',[],True,True)) 
    5353        buildIcon = WindowEntry(Response('build',[],True,False,name)) 
    5454        buildArt = pygame.image.load(os.path.abspath(resourceDir + os.sep + 'menu_icons' + os.sep + buildingLUT[name].imageFileName)) 
    55         buildIcon.addImage(Image((390,110),ICON_SIZE,ICON_SIZE,buildArt)) 
    56         buildIcon.addRectangle(Rectangle((20,100),460,100,CYAN)) 
    57         buildIcon.addText(Text((25,110),name,32,WHITE)) 
    58         buildIcon.addText(Text((25,140), buildingLUT[name].detailedDescript,24,WHITE)) 
     55        buildIcon.addImage(Image((370,10),ICON_SIZE,ICON_SIZE,buildArt)) 
     56        buildIcon.addRectangle(Rectangle((0,0),460,100,CYAN)) 
     57        buildIcon.addText(Text((5,10),name,32,WHITE)) 
     58        buildIcon.addText(Text((5,40), buildingLUT[name].detailedDescript,24,WHITE, 350)) 
    5959        descriptionWindow.addEntry(buildIcon) 
    6060        return descriptionWindow