Changeset 818


Ignore:
Timestamp:
03/14/11 18:34:49 (8 years ago)
Author:
aspidites
Message:

Patch by Aspidites et al:

  • squashed all commits that happened during the active_sprint before merging
Location:
trunk
Files:
109 added
16 deleted
45 edited
1 copied
49 moved

Legend:

Unmodified
Added
Removed
  • trunk/game/AUTHORS

    r512 r818  
    4343* icelus 
    4444* zenbitz 
     45* Technomage 
     46* Aspidites 
    4547 
    4648== Project management == 
  • trunk/game/README

    r687 r818  
    11================================================================================= 
    2                             PARPG TECHDEMO 1 README 
    3                           Last Updated: 15 December 2010 
     2                            PARPG TECHDEMO 2 README 
     3                          Last Updated: 6 March 2011 
    44================================================================================= 
    55 
    66== Introduction == 
    7 Welcome to the first official release of the open source post-apocalyptic RPG undertaking PARPG. This release is based on PARPG SVN trunk revison 522. Built against and tested with FIFE SVN trunk revision 3236. 
     7Welcome to the second official release of the open source post-apocalyptic RPG undertaking PARPG. This release is based on PARPG SVN trunk revison 877. Built against and tested with FIFE SVN trunk revision 3586. 
    88 
    99== Table of contents == 
  • trunk/game/design/rev233_Class_Design.uml

    r247 r818  
    6363<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="xO4d9faF3hERlAAcJbjrOgAA"> 
    6464<XPD:OBJ name="NameLabel" type="LabelView" guid="ZO8d9faF3hERlAAcJbjrOgAA"> 
    65 <XPD:ATTR name="Text" type="string">scripts</XPD:ATTR> 
     65<XPD:ATTR name="Text" type="string">parpg</XPD:ATTR> 
    6666</XPD:OBJ> 
    6767<XPD:OBJ name="StereotypeLabel" type="LabelView" guid="BPAd9faF3hERlAAcJbjrOgAA"> 
     
    42624262</XPD:OBJ> 
    42634263<XPD:OBJ name="OwnedElements[6]" type="UMLPackage" guid="6LGNI/SF3hERlAAcJbjrOgAA"> 
    4264 <XPD:ATTR name="Name" type="string">scripts</XPD:ATTR> 
     4264<XPD:ATTR name="Name" type="string">parpg</XPD:ATTR> 
    42654265<XPD:REF name="Namespace">SKFi7PKF3hERlAAcJbjrOgAA</XPD:REF> 
    42664266<XPD:ATTR name="#Views" type="integer">1</XPD:ATTR> 
  • trunk/game/dialogue/dialogue.license

    r493 r818  
    1 Dialogue scripts: 
     1Dialogue parpg: 
    22(c) 2009 PARPG development team, http://www.parpg.net 
    33 
  • trunk/game/dialogue_demo.py

    r684 r818  
    2121import os 
    2222import sys 
     23from optparse import OptionParser 
    2324 
    24 from scripts.common.optionparser import OptionParser, OptionError 
    25 from scripts.dialogueparsers import YamlDialogueParser 
    26 from scripts.dialogueprocessor import DialogueProcessor 
    27 from scripts.quest_engine import QuestEngine 
    28  
    29 def setupLogging(): 
    30     """Set various logging parameters for this module.""" 
    31     logging.basicConfig(filename='dialogue_demo.log') 
    32 setupLogging() 
    33  
    34 PARPG_ROOT_DIR = os.path.dirname(__file__) 
    35 """Absolute path to the root of the PARPG installation.""" 
    36 DIALOGUE_DIR = os.path.join(PARPG_ROOT_DIR, 'dialogue') 
    37 """Absolute path to the dialogue directory of the PARPG installation.""" 
    38 USAGE_MESSAGE = '''\ 
    39 usage: dialogue_demo.py [-h] [dialogue_file] 
    40 Script for testing dialogue files. 
    41  
    42 -h, --help                  Show this help message. 
    43 dialogue_file               YAML file containing a dialogue; if not specified, 
    44                                 the user will be prompted to choose a dialogue 
    45                                 file from the dialogue directory. 
    46 ''' 
     25from parpg.dialogueparsers import YamlDialogueParser 
     26from parpg.dialogueprocessor import DialogueProcessor 
     27from parpg.quest_engine import QuestEngine 
     28from parpg.settings import Settings 
    4729 
    4830class MockPlayerCharacter(object): 
     
    9981 
    10082 
    101 def selectDialogueFile(): 
     83def selectDialogueFile(settings): 
    10284    """ 
    10385    List all YAML dialogue files in the dialogue directory and prompt the user 
    10486    to select one for testing. 
    10587    """ 
    106     dialogue_files = [file_name for file_name in os.listdir(DIALOGUE_DIR)  
     88    dialogue_dir = os.path.join(settings.system_path,  
     89                                settings.parpg.DialoguesDirectory) 
     90    dialogue_files = [file_name for file_name in os.listdir(dialogue_dir)  
    10791                      if file_name.endswith('.yaml')] 
    10892    for index, file_name in enumerate(dialogue_files): 
     
    121105            break 
    122106     
    123     selected_file_path = os.path.join(DIALOGUE_DIR, selected_file_name) 
     107    selected_file_path = os.path.join(dialogue_dir, selected_file_name) 
    124108    return selected_file_path 
    125109 
     
    171155        dialogue_processor.reply(chosen_reply) 
    172156 
    173 def main(argv=sys.argv): 
    174     option_parser = OptionParser(usage=USAGE_MESSAGE) 
    175     for option in option_parser: 
    176         if (option in ['-h', '--help']): 
    177             print(option_parser.usage) 
    178             sys.exit(0) 
    179         else: 
    180             option_parser.error('unrecognized option "{0}"'.format(option)) 
     157def main(): 
     158    parser = OptionParser(description='Script for testing dialogue files') 
     159    parser.add_option('-s', '--settings', nargs=2, 
     160                      dest='paths', default=['.'], 
     161                      help='One or more paths to load settings from') 
     162    parser.add_option('-f', '--logfile', 
     163                        help='Name of log file to save to') 
     164    parser.add_option('-l', '--loglevel', default='critical', 
     165                    help='desired output level for log file') 
     166     
     167    opts, args = parser.parse_args() 
     168 
     169    settings = Settings(*opts.paths) 
     170 
     171    levels = {'debug': logging.DEBUG, 
     172              'info': logging.INFO, 
     173              'warning': logging.WARNING, 
     174              'error': logging.ERROR, 
     175              'critical': logging.CRITICAL} 
     176 
     177    #TODO: setup formating 
     178    logging.basicConfig(filename=opts.logfile, level=levels[opts.loglevel]) 
     179    logger = logging.getLogger('dialogue_demo') 
     180 
    181181    try: 
    182         dialogue_file_path = option_parser.get_next_prog_arg() 
    183     except OptionError: 
    184         dialogue_file_path = selectDialogueFile() 
     182        dialogue_file_path = args[0] 
     183    except IndexError: 
     184        logger.info('No dialogue file provided, generating a list..') 
     185        dialogue_file_path = selectDialogueFile(settings) 
     186 
    185187    game_state = { 
    186188        'quest': QuestEngine('quests'), 
  • trunk/game/dialogue_schema.yaml

    r668 r818  
    11--- 
    2 # A schema to validate dialogue scripts 
     2# A schema to validate dialogue parpg 
    33# to validate a script run: 
    44# 
  • trunk/game/gui/character_screen.xml

    r693 r818  
    1 <!-- 
    2  * Buttons have a dimension of 95x20 pixels 
    3  * 3 pixels vertical spacing is foreseen between buttons 
    4  * 7 pixels spacing is foreseen above and below the buttons 
    5  * Total height should be num_button*20 + (num_button-1)*3 + 2*7 
    6 --> 
    7 <VBox name="CharacterScreen" padding="0" background_image="gui/main_menu/main_menu_background_under_buttons.png" position_technique="center:center" size="320,340"> 
    8   <ImageButton name="startButton" up_image="gui/main_menu/new_game_plain.png" hover_image="gui/main_menu/new_game_hovered.png" down_image="gui/main_menu/new_game_pressed.png"/> 
    9   <ImageButton name="cancelButton"  up_image="gui/main_menu/exit_plain.png" hover_image="gui/main_menu/exit_hovered.png" down_image="gui/main_menu/exit_pressed.png"/> 
     1<VBox name="CharacterScreen" 
     2      background_image="gui/notebook/notebook_background.png" opaque="0" 
     3      min_size="800,600" max_size="800,600" 
     4      position_technique="center:center"> 
     5  <HBox vexpand="1" min_size="800,560" max_size="800,560" padding="0" opaque="0"> 
     6    <VBox min_size="22,0" max_size="22,9999" padding="0" opaque="0"> 
     7      <Spacer fixed_size="50"/> 
     8      <VBox name="leftTabs" min_size="22,0" max_size="22,9999" 
     9            padding="0" opaque="0"></VBox> 
     10      <Spacer fixed_size="40"/> 
     11    </VBox> 
     12    <VBox hexpand="1" min_size="734,560" max_size="734,560" padding="0" 
     13          opaque="0"> 
     14      <HBox name="topTabs" min_size="0,28" max_size="0,28" 
     15            opaque="0"> 
     16      </HBox> 
     17      <HBox min_size="732,517" max_size="732,517" opaque="0"> 
     18        <VBox name="leftPage" max_size="358,9999" min_size="358,0" 
     19              margins="5,5" opaque="0"> 
     20          <Spacer fixed_size="15"/> 
     21          <HBox opaque="0"> 
     22            <Spacer fixed_size="20"/> 
     23            <Icon name="portrait" image="gui/portraits/camilla.png" 
     24                  max_size="100,123"/> 
     25            <VBox hexpand="1" min_size="110,0" padding="1" opaque="0"> 
     26              <TextField name="characterName" text="Name" 
     27                         font="OldTypewriter" background_color="255,255,255"/> 
     28              <HBox opaque="0" padding="0"> 
     29                <Spacer/> 
     30                <Label text="Age" font="OldTypewriter_10"/> 
     31                <Spacer/> 
     32              </HBox> 
     33              <HBox opaque="0"> 
     34                <Spacer/> 
     35                <IntSpinner name="age" lower_limit="18" upper_limit="60" 
     36                            font="OldTypewriter_8" background_color="0,0,0,0" 
     37                            min_size="100,12" max_size="100,12"/> 
     38                <Spacer/> 
     39              </HBox> 
     40              <HBox opaque="0" padding="0"> 
     41                <Spacer/> 
     42                <Label text="Sex" font="OldTypewriter_10"/> 
     43                <Spacer/> 
     44              </HBox> 
     45              <HBox opaque="0"> 
     46                <Spacer/> 
     47                <Spinner name="sex" items="Male,Female" 
     48                         font="OldTypewriter_8" background_color="0,0,0,0" 
     49                         min_size="100,12" max_size="100,12"/> 
     50                <Spacer/> 
     51              </HBox> 
     52              <HBox opaque="0" padding="0"> 
     53                <Spacer/> 
     54                <Label text="Origin" font="OldTypewriter_10"/> 
     55                <Spacer/> 
     56              </HBox> 
     57              <HBox opaque="0"> 
     58                <Spacer/> 
     59                <Spinner name="origin" items="Oldster,Young Blood" 
     60                         font="OldTypewriter_8" background_color="0,0,0,0" 
     61                         min_size="100,12" max_size="100,12"/> 
     62                <Spacer/> 
     63              </HBox> 
     64              <HBox opaque="0" padding="0"> 
     65                <Spacer/> 
     66                <Label text="Portrait" font="OldTypewriter_10"/> 
     67                <Spacer/> 
     68              </HBox> 
     69              <HBox opaque="0"> 
     70                <Spacer/> 
     71                <Spinner name="portrait" items="" 
     72                         font="OldTypewriter_10" background_color="0,0,0,0" 
     73                         min_size="100,12" max_size="100,12"/> 
     74                <Spacer/> 
     75              </HBox> 
     76            </VBox> 
     77            <Icon name="model" image="gui/character_model.png" 
     78                  max_size="100,123"/> 
     79          </HBox> 
     80          <Spacer fixed_size="20"/> 
     81          <HBox opaque="0"> 
     82            <Spacer fixed_size="6"/> 
     83            <VBox min_size="200,0" max_size="200,9999" opaque="0"> 
     84              <HBox padding="0" opaque="0"> 
     85                <Label text="Primary Stats" font="OldTypewriter"/> 
     86                <Label name="statisticsPoints" text="(0)" 
     87                       font="OldTypewriter"/> 
     88              </HBox> 
     89              <VBox name="primaryStatisticsList" hexpand="1" 
     90                    opaque="0"> 
     91              </VBox> 
     92            </VBox> 
     93            <VBox hexpand="1" opaque="0"> 
     94              <HBox padding="0" opaque="0"> 
     95                <Label text="Traits" font="OldTypewriter"/> 
     96                <Label name="traitsPoints" text="(0)" font="OldTypewriter"/> 
     97                <Spacer/> 
     98              </HBox> 
     99              <ScrollArea> 
     100                <VBox name="traitsList" opaque="0"> 
     101                </VBox> 
     102              </ScrollArea> 
     103            </VBox> 
     104          </HBox> 
     105          <Spacer/> 
     106          <ScrollArea min_size="0,100" max_size="999,300" 
     107                      background_color="0,0,0,0"> 
     108            <TextField name="messageArea" base_color="0,0,0,0" 
     109                       background_color="0,0,0,0" font="OldTypewriter"/> 
     110          </ScrollArea> 
     111        </VBox> 
     112        <Spacer fixed_size="14"/> 
     113        <VBox name="rightPages" min_size="360,0" max_size="360,9999" 
     114              margins="10,20" hexpand="1" opaque="0"> 
     115          <TabWidget min_size="325,300" max_size="350,300" opaque="0" 
     116                     border_size="1"> 
     117            <VBox name="Secondary Stats" opaque="0"/> 
     118            <VBox name="Skills" opaque="0"/> 
     119          </TabWidget> 
     120          <Spacer fixed_size="25"/> 
     121          <HBox opaque="0"> 
     122            <Spacer fixed_size="14"/> 
     123            <InventoryGrid name="inventory" grid_size="6,2"/> 
     124          </HBox> 
     125          <HBox opaque="0"> 
     126            <Spacer/> 
     127            <VBox opaque="0" margins="1,1" min_size="100,50" max_size="100,50"> 
     128              <PercentageBar name="weightBar" value="25" border_size="1" 
     129                             foreground_color="50,50,50" min_size="80,20" 
     130                             max_size="80,20"/> 
     131              <HBox opaque="0"> 
     132                <Spacer/> 
     133                <Label text="weight:" font="OldTypewriter_8"/> 
     134                <Label name="weightPoints" text="50/200" font="OldTypewriter_8"/> 
     135                <Spacer/> 
     136              </HBox> 
     137            </VBox> 
     138            <Spacer fixed_size="10"/> 
     139            <VBox opaque="0" margins="1,1" min_size="100,50" max_size="100,50"> 
     140              <PercentageBar name="bulkBar" value="52" border_size="1" 
     141                             foreground_color="50,50,50" min_size="80,20" 
     142                             max_size="80,20"/> 
     143              <HBox opaque="0"> 
     144                <Spacer/> 
     145                <Label text="bulk:" font="OldTypewriter_8"/> 
     146                <Label name="bulkPoints" text="78/150" font="OldTypewriter_8"/> 
     147                <Spacer/> 
     148              </HBox> 
     149            </VBox> 
     150            <Spacer/> 
     151          </HBox> 
     152        </VBox> 
     153      </HBox> 
     154      <HBox name="bottomTabs" min_size="0,24" max_size="9999,24" opaque="0"> 
     155        <Spacer fixed_size="70"/> 
     156        <ImageButton name="cancelButton" text="Cancel" font="OldTypewriter_10" 
     157                     min_size="101,0" max_size="101,9999" 
     158                     up_image="gui/notebook/tabs/tab3_bg_normal_bottom.png" 
     159                     hover_image="gui/notebook/tabs/tab3_bg_normal_bottom.png" 
     160                     down_image="gui/notebook/tabs/tab3_bg_dark_bottom.png"/> 
     161        <Spacer fixed_size="100"/> 
     162        <ImageButton name="clearButton" text="Clear" font="OldTypewriter_10" 
     163                     min_size="52,0" max_size="52,9999" 
     164                     up_image="gui/notebook/tabs/tab5_bg_normal_bottom.png" 
     165                     hover_image="gui/notebook/tabs/tab5_bg_normal_bottom.png" 
     166                     down_image="gui/notebook/tabs/tab5_bg_dark_bottom.png"/> 
     167        <Spacer fixed_size="225"/> 
     168        <ImageButton name="startButton" text="Start Game" font="OldTypewriter_10" 
     169                     min_size="101,0" max_size="101,9999" 
     170                     up_image="gui/notebook/tabs/tab2_bg_normal_bottom.png" 
     171                     hover_image="gui/notebook/tabs/tab2_bg_normal_bottom.png" 
     172                     down_image="gui/notebook/tabs/tab2_bg_dark_bottom.png"/> 
     173      </HBox> 
     174    </VBox> 
     175    <VBox min_size="22,0" max_size="22,9999" padding="0" opaque="0"> 
     176      <Spacer fixed_size="50"/> 
     177      <VBox name="rightTabs" min_size="22,0" max_size="22,9999" 
     178            opaque="0"> 
     179      </VBox> 
     180      <Spacer fixed_size="40"/> 
     181    </VBox> 
     182    <Spacer fixed_size="4"/> 
     183  </HBox> 
     184  <HBox name="bottomBar" vexpand="1" opaque="0"> 
     185  </HBox> 
    10186</VBox> 
  • trunk/game/gui/hud_pause_menu.xml

    r648 r818  
    1111  <Button name="saveButton"    text="Save Game"   position="25,53" min_size="95,20" max_size="95,20"/> 
    1212  <Button name="loadButton"    text="Load Game"   position="25,76"  min_size="95,20" max_size="95,20"/> 
    13   <Button name="optionsButton" text="Options"     position="25,99" min_size="95,20" max_size="95,20"/> 
     13  <Button name="settingsButton" text="Settings"     position="25,99" min_size="95,20" max_size="95,20"/> 
    1414  <Button name="helpButton"    text="Help"        position="25,122" min_size="95,20" max_size="95,20" /> 
    1515  <Button name="quitButton"    text="Quit"        position="25,145" min_size="95,20" max_size="95,20" /> 
  • trunk/game/gui/inventory.xml

    r479 r818  
    1 <Window title="Inventory" min_size="500,580"> 
    2   <Label text="Character Name Here" name="charName"/>/ 
    3  
    4   <!-- TODO: Document this mess --> 
    5  
    6   <HBox max_size="275,100"> 
    7     <Spacer /> 
    8     <ImageButton name="Head" up_image="gui/inv_images/inv_head.png" down_image="gui/inv_images/inv_head.png" hover_image="gui/inv_images/inv_head.png" text="" /> 
    9   </HBox> 
    10    
    11   <HBox max_size="460,320"> 
    12     <Spacer /> 
    13      
    14     <VBox max_size="50,300"> 
    15       <ImageButton name="LeftHeld" up_image="gui/inv_images/inv_litem.png" down_image="gui/inv_images/inv_litem.png" hover_image="gui/inv_images/inv_litem.png" text="" /> 
    16       <ImageButton name="Ready1" up_image="gui/inv_images/inv_belt_pouches.png" down_image="gui/inv_images/inv_belt_pouches.png" hover_image="gui/inv_images/inv_belt_pouches.png" text="" /> 
    17       <ImageButton name="Ready2" up_image="gui/inv_images/inv_belt_pouches.png" down_image="gui/inv_images/inv_belt_pouches.png" hover_image="gui/inv_images/inv_belt_pouches.png" text="" /> 
    18       <Spacer /> 
    19       <ImageButton name="LeftFoot" up_image="gui/inv_images/inv_lfoot.png" down_image="gui/inv_images/inv_lfoot.png" hover_image="gui/inv_images/inv_lfoot.png" text="" /> 
    20     </VBox> 
    21      
    22     <VBox max_size="50,165"> 
    23       <ImageButton name="LeftHand" up_image="gui/inv_images/inv_lhand.png" down_image="gui/inv_images/inv_lhand.png" hover_image="gui/inv_images/inv_lhand.png" text="" /> 
    24       <Spacer /> 
    25       <ImageButton name="Body" up_image="gui/inv_images/inv_torso.png" down_image="gui/inv_images/inv_torso.png" hover_image="gui/inv_images/inv_torso.png" text="" /> 
    26     </VBox> 
    27  
    28     <VBox min_size="200,350"> 
    29       <Spacer /> 
    30       <Icon name="charPreview" image="gui/inv_images/char_preview.png" /> 
    31     </VBox> 
    32      
    33     <VBox max_size="50,165"> 
    34       <ImageButton name="RightHand" up_image="gui/inv_images/inv_rhand.png" down_image="gui/inv_images/inv_rhand.png" hover_image="gui/inv_images/inv_rhand.png" text="" /> 
    35       <Spacer /> 
    36       <ImageButton name="Belt" up_image="gui/inv_images/inv_belt.png" down_image="gui/inv_images/inv_belt.png" hover_image="gui/inv_images/inv_belt.png" text="" /> 
    37     </VBox> 
    38      
    39     <VBox max_size="50,300"> 
    40       <ImageButton name="RightHeld" up_image="gui/inv_images/inv_ritem.png" down_image="gui/inv_images/inv_ritem.png" hover_image="gui/inv_images/inv_ritem.png" text="" /> 
    41       <ImageButton name="Ready3" up_image="gui/inv_images/inv_belt_pouches.png" down_image="gui/inv_images/inv_belt_pouches.png" hover_image="gui/inv_images/inv_belt_pouches.png" text="" /> 
    42       <ImageButton name="Ready4" up_image="gui/inv_images/inv_belt_pouches.png" down_image="gui/inv_images/inv_belt_pouches.png" hover_image="gui/inv_images/inv_belt_pouches.png" text="" /> 
    43       <Spacer /> 
    44       <ImageButton name="RightFoot" up_image="gui/inv_images/inv_rfoot.png" down_image="gui/inv_images/inv_rfoot.png" hover_image="gui/inv_images/inv_rfoot.png" text="" /> 
    45     </VBox> 
    46      
    47   </HBox> 
    48    
    49   <Spacer /> 
    50    
    51   <!-- Main Inventory !--> 
    52   <HBox> 
    53     <VBox> 
    54       <HBox max_size="385,90"> 
    55         <Spacer /> 
    56         <ImageButton name="A1" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    57         <ImageButton name="A2" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    58         <ImageButton name="A3" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    59         <ImageButton name="A4" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    60         <ImageButton name="A5" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    61       </HBox> 
    62        
    63       <HBox max_size="385,90"> 
    64         <Spacer /> 
    65         <ImageButton name="B1" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    66         <ImageButton name="B2" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    67         <ImageButton name="B3" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    68         <ImageButton name="B4" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    69         <ImageButton name="B5" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    70       </HBox> 
    71        
    72       <HBox max_size="385,90"> 
    73         <Spacer /> 
    74         <ImageButton name="C1" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    75         <ImageButton name="C2" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    76         <ImageButton name="C3" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    77         <ImageButton name="C4" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    78         <ImageButton name="C5" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    79       </HBox> 
    80        
    81       <HBox max_size="385,90"> 
    82         <Spacer /> 
    83         <ImageButton name="D1" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    84         <ImageButton name="D2" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    85         <ImageButton name="D3" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    86         <ImageButton name="D4" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    87         <ImageButton name="D5" up_image="gui/inv_images/inv_backpack.png" down_image="gui/inv_images/inv_backpack.png" hover_image="gui/inv_images/inv_backpack.png" text=""/> 
    88       </HBox> 
    89        
    90       <Spacer /> 
    91        
    92       <HBox min_size="500,0"> 
    93         <Spacer /> 
    94         <Button name="close_button" text="Close" /> 
    95       </HBox> 
    96        
     1<VBox background_image="gui/notebook/notebook_background.png" opaque="0" 
     2      min_size="780,545"> 
     3  <Spacer fixed_size="20"></Spacer> 
     4  <HBox opaque="0" padding="0"> 
     5    <HBox name="equipmentPage" min_size="380,510" max_size="380,510" opaque="0"> 
     6      <VBox name="equipmentTabs" min_size="20,545" max_size="20,545" opaque="0"> 
     7        <Spacer fixed_size="194"></Spacer> 
     8        <ImageButton name="characterButton" 
     9                     up_image="gui/notebook/character_plain.png" 
     10                     down_image="gui/notebook/character_back.png" 
     11                     hover_image="gui/notebook/character_hovered.png"> 
     12        </ImageButton> 
     13      </VBox> 
     14      <VBox name="equipmentContent" hexpand="1" opaque="0"> 
     15        <HBox min_size="0,120" padding="0" opaque="0"> 
     16          <Spacer fixed_size="25"></Spacer> 
     17          <VBox opaque="0"> 
     18            <Spacer fixed_size="20"></Spacer> 
     19            <VBox margins="1,1" opaque="0"> 
     20            <Icon name="equipmentIcon" border_size="1" 
     21                  image="gui/portraits/drunkard.png"></Icon> 
     22            </VBox> 
     23          </VBox> 
     24          <Label name="equipmentDescription" foreground_color="0,0,0" 
     25                 text="Equipment description here."></Label> 
     26        </HBox> 
     27        <HBox opaque="0" padding="0" vexpand="1"> 
     28          <Spacer fixed_size="20"></Spacer> 
     29          <VBox padding="20" opaque="0"> 
     30            <Spacer fixed_size="40"></Spacer> 
     31            <EquipmentSlot name="shirtSlot" label_text="shirt"> 
     32            </EquipmentSlot> 
     33            <EquipmentSlot name="rightHandSlot" label_text="rhand"> 
     34            </EquipmentSlot> 
     35            <EquipmentSlot name="beltSlot" label_text="belt"></EquipmentSlot> 
     36            <EquipmentSlot name="bootsSlot" label_text="boots"></EquipmentSlot> 
     37          </VBox> 
     38          <HBox opaque="0" vexpand="1"> 
     39            <Spacer fixed_size="10"></Spacer> 
     40            <Icon name="puppetIcon" image="gui/inv_images/char_preview.png"> 
     41            </Icon> 
     42          </HBox> 
     43          <VBox padding="20" opaque="0"> 
     44            <EquipmentSlot name="headSlot" label_text="head"></EquipmentSlot> 
     45            <EquipmentSlot name="neckSlot" label_text="back"></EquipmentSlot> 
     46            <EquipmentSlot name="leftHandSlot" label_text="lhand"></EquipmentSlot> 
     47            <EquipmentSlot name="pantsSlot" label_text="pants"></EquipmentSlot> 
     48          </VBox> 
     49          <Spacer fixed_size="20"></Spacer> 
     50        </HBox> 
     51      </VBox> 
     52    </HBox> 
     53    <Spacer fixed_size="24"></Spacer> 
     54    <VBox name="inventoryPage" min_size="376,510" max_size="376,510" 
     55          opaque="0"> 
     56      <VBox name="inventoryContent" hexpand="1" min_size="350,0" opaque="0"> 
     57        <HBox min_size="0,120" opaque="0"> 
     58          <Label text="Item description here."></Label> 
     59        </HBox> 
     60        <InventoryGrid grid_size="6,7"></InventoryGrid> 
     61      </VBox> 
     62      <Spacer fixed_size="20"></Spacer> 
    9763    </VBox> 
    9864  </HBox> 
    99    
    100 </Window> 
     65</VBox> 
  • trunk/game/gui/main_menu.xml

    r655 r818  
    1 <!-- 
    2  * Buttons have a dimension of 95x20 pixels 
    3  * 3 pixels vertical spacing is foreseen between buttons 
    4  * 7 pixels spacing is foreseen above and below the buttons 
    5  * Total height should be num_button*20 + (num_button-1)*3 + 2*7 
    6 --> 
    7 <VBox name="MainMenuMenu" padding="0" background_image="gui/main_menu/main_menu_background_under_buttons.png" position_technique="center:center" size="320,340"> 
    8   <ImageButton name="continueButton" up_image="gui/main_menu/continue_disabled.png"/> 
    9   <ImageButton name="newButton" up_image="gui/main_menu/new_game_plain.png" hover_image="gui/main_menu/new_game_hovered.png" down_image="gui/main_menu/new_game_pressed.png"/> 
    10   <ImageButton name="loadButton" up_image="gui/main_menu/load_game_plain.png" hover_image="gui/main_menu/load_game_hovered.png" down_image="gui/main_menu/load_game_pressed.png"/> 
    11   <ImageButton name="optionsButton" up_image="gui/main_menu/options_plain.png" hover_image="gui/main_menu/options_hovered.png" down_image="gui/main_menu/options_pressed.png"/> 
    12   <ImageButton name="creditsButton" up_image="gui/main_menu/credits_disabled.png"/> 
    13   <ImageButton name="quitButton"  up_image="gui/main_menu/exit_plain.png" hover_image="gui/main_menu/exit_hovered.png" down_image="gui/main_menu/exit_pressed.png"/> 
     1<VBox name="MainMenuMenu" background_image="gui/notebook/notebook_background.png" padding="0" position_technique="center:center" opaque="0" min_size="780,545" max_size="780,545"> 
     2  <HBox vexpand="1" padding="0" opaque="0"> 
     3    <VBox min_size="20,0" padding="0" opaque="0"> 
     4      <Spacer fixed_size="50"></Spacer> 
     5      <VBox name="leftTabs" min_size="20,0" padding="0" opaque="0"></VBox> 
     6      <Spacer fixed_size="40"></Spacer> 
     7    </VBox> 
     8    <VBox padding="0" opaque="0"> 
     9      <HBox name="topTabs" min_size="0,30" opaque="0"></HBox> 
     10      <HBox vexpand="1" opaque="0"> 
     11        <Spacer fixed_size="32" /> 
     12                <!-- by adding hexpand, buttons get resized to size of hbox (which is what I want) but I don't know why)--> 
     13        <VBox name="leftPage" hexpand="1" max_size="312,474" min_size="312,474" padding="8" opaque="0"> 
     14          <Spacer fixed_size="32"/> 
     15          <Button base_color="0,0,0,0" name="newButton" text="New Game" font="OldTypewriter"/> 
     16          <Button base_color="0,0,0,0" name="loadButton" text="Load Game" font="OldTypewriter"/> 
     17          <Button base_color="0,0,0,0" name="settingsButton" text="Settings" font="OldTypewriter"/> 
     18          <Button base_color="0,0,0,0" name="creditsButton" text="Credits" font="OldTypewriter"/> 
     19                </VBox> 
     20        <Spacer fixed_size="20" /> 
     21        <VBox name="rightPages" padding="8" opaque="0" position_technique="center:center"></VBox> 
     22      </HBox> 
     23      <HBox name="bottomTabs" min_size="0,30" opaque="0"> 
     24          <!-- the tabl below is supposed to be at bottom left.. for now? --> 
     25      <Spacer fixed_size="32"/> 
     26          <ImageButton max_size="99,24" text="Quit" name="quitButton" font="OldTypewriter" up_image="gui/notebook/tabs/tab2_bg_dark_bottom.png" hover_image="gui/notebook/tabs/tab2_bg_normal_bottom.png" down_image="gui/notebook/tabs/tab2_bg_normal_bottom.png" /> 
     27          </HBox> 
     28    </VBox> 
     29    <VBox min_size="20,0" padding="0" opaque="0"> 
     30      <Spacer fixed_size="50"></Spacer> 
     31      <VBox name="rightTabs" min_size="20,0" opaque="0"></VBox> 
     32      <Spacer fixed_size="40"></Spacer> 
     33    </VBox> 
     34    <Spacer fixed_size="4"></Spacer> 
     35  </HBox> 
    1436</VBox> 
  • trunk/game/license/gpl30.license

    r490 r818  
    134134  The "Corresponding Source" for a work in object code form means all 
    135135the source code needed to generate, install, and (for an executable 
    136 work) run the object code and to modify the work, including scripts to 
     136work) run the object code and to modify the work, including parpg to 
    137137control those activities.  However, it does not include the work's 
    138138System Libraries, or general-purpose tools or generally available free 
  • trunk/game/maps/maps.license

    r493 r818  
    1 Dialogue scripts: 
     1Dialogue parpg: 
    22(c) 2009 PARPG development team, http://www.parpg.net 
    33 
  • trunk/game/parpg/application.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This program is free software: you can redistribute it and/or modify 
    42#   it under the terms of the GNU General Public License as published by 
     
    1614and the basic Listener for PARPG """ 
    1715 
     16import os 
    1817 
    1918from fife import fife 
    2019from fife.extensions import pychan 
     20from fife.extensions.serializers.xmlanimation import XMLAnimationLoader 
    2121from fife.extensions.basicapplication import ApplicationBase 
    2222 
    23 from scripts.gamemodel import GameModel 
    24 from scripts.mainmenuview import MainMenuView 
    25 from scripts import console 
    26 from scripts.mainmenucontroller import MainMenuController 
    27 from scripts.common.listeners.event_listener import EventListener 
    28 from scripts.common.listeners.key_listener import KeyListener 
    29 from scripts.common.listeners.mouse_listener import MouseListener 
    30 from scripts.common.listeners.command_listener import CommandListener 
    31 from scripts.common.listeners.console_executor import ConsoleExecuter 
    32 from scripts.common.listeners.widget_listener import WidgetListener 
     23from parpg import console 
     24from parpg.gamemodel import GameModel 
     25from parpg.mainmenuview import MainMenuView 
     26from parpg.mainmenucontroller import MainMenuController 
     27from parpg.common.listeners.event_listener import EventListener 
     28from parpg.common.listeners.key_listener import KeyListener 
     29from parpg.common.listeners.mouse_listener import MouseListener 
     30from parpg.common.listeners.command_listener import CommandListener 
     31from parpg.common.listeners.console_executor import ConsoleExecuter 
     32from parpg.common.listeners.widget_listener import WidgetListener 
    3333 
    3434class KeyFilter(fife.IKeyFilter): 
     
    6161           @type model: GameModel 
    6262           @param model: The game model""" 
     63 
    6364        KeyListener.__init__(self, event_listener) 
    6465        MouseListener.__init__(self, event_listener) 
     
    110111        """Initialise the instance. 
    111112           @return: None""" 
    112         super(PARPGApplication, self).__init__(setting) 
     113        self._setting = setting 
     114        self.engine = fife.Engine() 
     115        fonts_dir = os.path.join(self._setting.system_path, 
     116                                 self._setting.fife.FontsDirectory) 
     117        self.fonts_directory = fonts_dir 
     118        self.loadSettings() 
     119        self.engine.init() 
     120        self._animationloader = XMLAnimationLoader(self.engine.getImagePool(), 
     121                                                   self.engine.getVFS()) 
     122        self.engine.getAnimationPool().addResourceLoader(self._animationloader) 
     123 
    113124        pychan.init(self.engine, debug = True) 
     125        pychan.setupModalExecution(self.mainLoop,self.breakFromMainLoop) 
     126 
     127        self.quitRequested = False 
     128        self.breakRequested = False 
     129        self.returnValues = [] 
    114130        #self.engine.getModel(self) 
    115131        self.model = GameModel(self.engine, setting) 
    116         self.model.maps_file = self._setting.get("PARPG", "MapsFile") 
    117132        self.model.readMapFiles() 
    118         self.model.object_db_file = self._setting.get("PARPG",  
    119                                                       "ObjectDatabaseFile")  
    120133        self.model.readObjectDB() 
    121         self.model.agents_directory = self._setting.get("PARPG", 
    122                                                         "AgentsDirectory")  
    123134        self.model.getAgentImportFiles() 
    124         self.model.all_agents_file = self._setting.get("PARPG", "AllAgentsFile") 
    125135        self.model.readAllAgents() 
    126         self.model.dialogues_directory = self._setting.get("PARPG",  
    127                                                            "DialoguesDirectory") 
    128136        self.model.getDialogues() 
    129137        self.view = MainMenuView(self.engine, self.model) 
     138        self.loadFonts(self.fonts_directory) 
    130139        self.event_listener = EventListener(self.engine) 
    131140        self.controllers = [] 
    132         controller = MainMenuController(self.engine,  
    133                                                         self.view,  
    134                                                         self.model, 
    135                                                         self) 
     141        controller = MainMenuController(self.engine, self.view, self.model,  
     142                                        self) 
    136143        #controller.initHud() 
    137144        self.controllers.append(controller) 
     
    140147                                            self.view,  
    141148                                            self.model) 
    142         #start_map = self._setting.get("PARPG", "Map") 
     149        #start_map = self._setting.fife.get("PARPG", "Map") 
    143150        #self.model.changeMap(start_map) 
    144151 
     152    def loadFonts(self, fonts_directory): 
     153        file_names = os.listdir(fonts_directory) 
     154        for file_name in file_names: 
     155            base_name, extension = os.path.splitext(file_name) 
     156            if extension == '.fontdef': 
     157                file_path = os.path.join(fonts_directory, file_name) 
     158                pychan.loadFonts(file_path) 
     159 
     160    def loadSettings(self): 
     161        """ 
     162        Load the settings from a python file and load them into the engine. 
     163        Called in the ApplicationBase constructor. 
     164        """ 
     165 
     166        engineSetting = self.engine.getSettings() 
     167        engineSetting.setDefaultFontGlyphs(self._setting.fife.FontGlyphs) 
     168        engineSetting.setDefaultFontPath(os.path.join(self.fonts_directory, 
     169                                                       self._setting.fife.Font)) 
     170        engineSetting.setDefaultFontSize(self._setting.fife.DefaultFontSize) 
     171        engineSetting.setBitsPerPixel(self._setting.fife.BitsPerPixel) 
     172        engineSetting.setInitialVolume(self._setting.fife.InitialVolume) 
     173        engineSetting.setSDLRemoveFakeAlpha(self._setting.fife.SDLRemoveFakeAlpha) 
     174        engineSetting.setScreenWidth(self._setting.fife.ScreenWidth) 
     175        engineSetting.setScreenHeight(self._setting.fife.ScreenHeight) 
     176        engineSetting.setRenderBackend(self._setting.fife.RenderBackend) 
     177        engineSetting.setFullScreen(self._setting.fife.FullScreen) 
     178        engineSetting.setVideoDriver(self._setting.fife.VideoDriver) 
     179        engineSetting.setLightingModel(self._setting.fife.Lighting) 
     180        engineSetting.setColorKeyEnabled(self._setting.fife.ColorKeyEnabled) 
     181 
     182        engineSetting.setColorKey(*[int(digit)  
     183                                    for digit in self._setting.fife.ColorKey]) 
     184 
     185        engineSetting.setWindowTitle(self._setting.fife.WindowTitle) 
     186        engineSetting.setWindowIcon(os.path.join(self._setting.system_path,  
     187                                                 self._setting.fife.IconsDirectory, 
     188                                                 self._setting.fife.WindowIcon)) 
     189 
    145190    def createListener(self): 
    146         """@return: None""" 
    147         # already created in constructor 
    148         # but if we don't put one here, Fife gets all fussy :-) 
     191        """ __init__ takes care of creating an event listener, so 
     192            basicapplication's createListener is harmful. Without  
     193            overriding it, the program quit's on esc press, rather than 
     194            invoking the main menu 
     195        """ 
    149196        pass 
    150      
     197 
    151198    def pushController(self, controller): 
    152199        """Adds a controller to the list to be the current active one.""" 
  • trunk/game/parpg/common/listeners/event_listener.py

    r791 r818  
    2020 
    2121from fife import fife 
     22import logging 
     23 
     24logger = logging.getLogger('event_listener') 
    2225 
    2326class EventListener(fife.IKeyListener,  
     
    5154                self.listeners[listener_type].append(listener)             
    5255        else: 
    53             print "Listener type \" " + listener_type + "\" not supported" 
     56            logger.warning("Listener type " 
     57                                  "'{0}' not supported".format(listener_type)) 
    5458     
    5559    def removeListener(self, listener_type, listener): 
     
    5862            self.listeners[listener_type].remove(listener) 
    5963        else: 
    60             print "Listener type \" " + listener_type + "\" not supported" 
     64            logger.warning("Listener type " 
     65                                  "'{0}' not supported".format(listener_type)) 
    6166             
    6267    def mousePressed(self, evt): 
  • trunk/game/parpg/common/utils.py

    r791 r818  
    4343            yield os.path.join(path, filename) 
    4444 
    45 def loadSettings(settings_file = "./settings.xml"): 
    46     from fife.extensions.fife_settings import Setting 
    47     return Setting(app_name = "PARPG", 
    48                    settings_file = settings_file,  
    49                    settings_gui_xml = "") 
    50  
    5145def dedent_chomp(string): 
    5246    """Remove common leading whitespace and chomp each non-blank line.""" 
    5347    dedented_string = dedent(string).strip() 
    54     lines = [] 
    55     for line in dedented_string.splitlines(): 
    56         if not line or line.isspace(): 
     48    lines = dedented_string.splitlines() 
     49    formatted_lines = [] 
     50    for index in range(len(lines)): 
     51        line = lines[index] 
     52        if index == len(lines) - 1: 
     53            # Don't do anything to the last line. 
     54            pass 
     55        elif not line or line.isspace(): 
    5756            line = '\n\n' 
    5857        else: 
    5958            line = ''.join([line, ' ']) 
    60         lines.append(line) 
    61     result = ''.join(lines) 
     59        formatted_lines.append(line) 
     60    result = ''.join(formatted_lines) 
    6261    return result 
  • trunk/game/parpg/console.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This program is free software: you can redistribute it and/or modify 
    42#   it under the terms of the GNU General Public License as published by 
  • trunk/game/parpg/controllerbase.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1513#   You should have received a copy of the GNU General Public License 
    1614#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
     15import os 
    1716from fife import fife 
    1817 
    19 from scripts.common.listeners.key_listener import KeyListener 
    20 from scripts.common.listeners.mouse_listener import MouseListener 
    21 from scripts.common.listeners.command_listener import CommandListener 
     18from parpg.common.listeners.key_listener import KeyListener 
     19from parpg.common.listeners.mouse_listener import MouseListener 
     20from parpg.common.listeners.command_listener import CommandListener 
    2221 
    2322class ControllerBase(KeyListener, MouseListener, CommandListener): 
     
    3332        @type engine: fife.Engine 
    3433        @param view: Instance of a GameSceneView 
    35         @param type: scripts.GameSceneView 
     34        @param type: parpg.GameSceneView 
    3635        @param model: The model that has the current gamestate 
    37         @type model: scripts.GameModel 
     36        @type model: parpg.GameModel 
    3837        @param application: The application that created this controller 
    39         @type application: scripts.PARPGApplication 
     38        @type application: parpg.PARPGApplication 
    4039        @param settings: The current settings of the application 
    4140        @type settings: fife.extensions.fife_settings.Setting 
     
    8584        """Reset cursor to default image. 
    8685           @return: None""" 
    87         image = self.model.settings.get("PARPG", "CursorDefault") 
     86        image = os.path.join(self.model.settings.system_path, 
     87                             self.model.settings.parpg.GuiDirectory, 
     88                             self.model.settings.parpg.CursorDirectory, 
     89                             self.model.settings.parpg.CursorDefault) 
    8890        self.setMouseCursor(image, image) 
    8991         
  • trunk/game/parpg/dialogue.py

    r791 r818  
    1 #!/usr/bin/env python 
    2 # 
    31#   This file is part of PARPG. 
    42# 
     
    2321except ImportError: 
    2422    # Python version 2.4-2.6 doesn't have the OrderedDict 
    25     from scripts.common.ordereddict import OrderedDict 
     23    from parpg.common.ordereddict import OrderedDict 
    2624 
    2725class Dialogue(object): 
  • trunk/game/parpg/dialogueactions.py

    r791 r818  
    1 #!/usr/bin/env python 
    2 # 
    31#   This file is part of PARPG. 
    42# 
     
    2119import logging 
    2220 
    23 def setupLogging(): 
    24     """Set various logging parameters for this module.""" 
    25     module_logger = logging.getLogger('dialogueaction') 
    26     if __debug__: 
    27         module_logger.setLevel(logging.DEBUG) 
    28 setupLogging() 
     21logger = logging.getLogger('dialogueaction') 
    2922 
    3023class DialogueAction(object): 
  • trunk/game/parpg/dialoguecontroller.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    2927        @type engine: fife.Engine 
    3028        @param view: Instance of a GameSceneView 
    31         @param type: scripts.GameSceneView 
     29        @param type: parpg.GameSceneView 
    3230        @param model: The model that has the current gamestate 
    33         @type model: scripts.GameModel 
     31        @type model: parpg.GameModel 
    3432        @param application: The application that created this controller 
    35         @type application: scripts.PARPGApplication 
     33        @type application: parpg.PARPGApplication 
    3634        @param settings: The current settings of the application 
    3735        @type settings: fife.extensions.fife_settings.Setting 
  • trunk/game/parpg/dialogueparsers.py

    r791 r818  
    1 #!/usr/bin/env python 
    2 # 
    31#   This file is part of PARPG. 
    42# 
     
    2725@TODO Technomage 2010-11-13: Support reading and writing unicode. 
    2826""" 
    29 import logging 
    3027try: 
    3128    from cStringIO import StringIO 
     
    3734except ImportError: 
    3835    # Python version 2.4-2.6 doesn't have the OrderedDict 
    39     from scripts.common.ordereddict import OrderedDict 
     36    from parpg.common.ordereddict import OrderedDict 
    4037import re 
    4138import textwrap 
     
    4340import yaml 
    4441 
    45 from scripts import COPYRIGHT_HEADER 
    46 from scripts.dialogue import (Dialogue, DialogueSection, DialogueResponse, 
     42from parpg import COPYRIGHT_HEADER 
     43from parpg.dialogue import (Dialogue, DialogueSection, DialogueResponse, 
    4744    DialogueGreeting) 
    48 from scripts.dialogueactions import DialogueAction 
    49  
    50 def setup_logging(): 
    51     """Set various logging parameters for this module.""" 
    52     module_logger = logging.getLogger('dialogueparser') 
    53     if (__debug__): 
    54         module_logger.setLevel(logging.DEBUG) 
    55 setup_logging() 
     45from parpg.dialogueactions import DialogueAction 
     46 
     47import logging 
     48logger = logging.getLogger('dialogueparser') 
    5649 
    5750class DialogueFormatError(Exception): 
  • trunk/game/parpg/dialogueprocessor.py

    r791 r818  
    1 #!/usr/bin/env python 
    2 # 
    31#   This file is part of PARPG. 
    42# 
     
    2119import logging 
    2220 
    23 from scripts.common.utils import dedent_chomp 
     21from parpg.common.utils import dedent_chomp 
    2422 
    2523if (__debug__): 
    2624    from collections import Sequence, MutableMapping 
    27     from scripts.dialogue import Dialogue 
     25    from parpg.dialogue import Dialogue 
    2826 
    29 def setupLogging(): 
    30     """Set various logging parameters for this module.""" 
    31     module_logger = logging.getLogger('dialogueengine') 
    32     if (__debug__): 
    33         module_logger.setLevel(logging.DEBUG) 
    34 setupLogging() 
     27logger = logging.getLogger('dialogueprocessor') 
    3528 
    3629class DialogueProcessor(object): 
  • trunk/game/parpg/gamemap.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1917 
    2018from fife.extensions.loaders import loadMapFile 
    21 from scripts.common.utils import loadSettings 
    22  
    23  
    24 Settings = loadSettings() 
    2519 
    2620class GameMap(fife.MapChangeListener): 
     
    9589        At this point we also set the viewport to the current resolution.""" 
    9690        for cam in self.map.getCameras(): 
    97             width = self.engine.getSettings().getScreenWidth() 
    98             height = self.engine.getSettings().getScreenHeight()  
     91            width = self.model.settings.fife.ScreenWidth 
     92            height = self.model.settings.fife.ScreenHeight 
    9993            viewport = fife.Rect(0, 0, width, height) 
    10094            cam.setViewPort(viewport) 
     
    117111        text = self.engine.getGuiManager().\ 
    118112                        createFont('fonts/rpgfont.png', 0, \ 
    119                                    Settings.get("FIFE", "FontGlyphs")) 
     113                                   self.model.settings.fife.FontGlyphs) 
    120114        rend.changeDefaultFont(text) 
    121115        rend.activateAllLayers(self.map) 
  • trunk/game/parpg/gamemodel.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    3230from common.utils import parseBool 
    3331from inventory import Inventory 
    34 from scripts.dialogueparsers import YamlDialogueParser, DialogueFormatError 
     32from parpg.dialogueparsers import YamlDialogueParser, DialogueFormatError 
    3533 
    3634try: 
     
    4038 
    4139import yaml 
     40 
     41logger = logging.getLogger('gamemodel') 
    4242 
    4343class GameModel(object): 
     
    5555        @type emgome: fife.Engine  
    5656        @param setting: The applications settigns 
    57         @type setting: fife_settings.Setting  
     57        @type setting: parpg.settings.Settings object 
    5858        @return: None""" 
     59        self.settings = settings 
     60 
    5961        self.map_change = False 
    6062        self.load_saver = False 
    6163        self.savegame = None 
    62         self.game_state = GameState(quests_dir = settings.get("PARPG", 
    63                                                              "QuestsDirectory")) 
     64        quests_directory = os.path.join(self.settings.system_path, 
     65                                        self.settings.parpg.QuestsDirectory) 
     66        self.game_state = GameState(quests_dir=quests_directory) 
    6467        #self.game_state.quest_engine =  
    6568        #self.game_state.quest_engine.readQuests() 
     
    7477        self.engine = engine 
    7578        self.fife_model = engine.getModel() 
    76         self.game_state.maps_file = "maps/maps.yaml" 
    77         self.all_agents_file = "maps/all_agents.yaml" 
    78         self.object_db_file = "objects/object_database.yaml" 
    79         self.agents_directory = "objects/" 
    80         self.dialogues_directory = "dialogue" 
     79 
     80        # set values from settings 
     81        maps_file = os.path.join(self.settings.system_path,  
     82                                 self.settings.parpg.MapsDirectory, 
     83                                 self.settings.parpg.MapsFile) 
     84        self.game_state.maps_file = maps_file 
     85        all_agents_file = os.path.join(self.settings.system_path, 
     86                                       self.settings.parpg.MapsDirectory, 
     87                                       self.settings.parpg.AllAgentsFile) 
     88        self.all_agents_file = all_agents_file 
     89        objects_dir = os.path.join(self.settings.system_path, 
     90                                    self.settings.parpg.ObjectsDirectory) 
     91        self.objects_directory = objects_dir 
     92        object_db_file = os.path.join(self.objects_directory, 
     93                                      self.settings.parpg.ObjectDatabaseFile) 
     94        self.object_db_file = object_db_file 
     95        dialogues_dir = os.path.join(self.settings.system_path,  
     96                                     self.settings.parpg.DialoguesDirectory) 
     97        self.dialogues_directory = dialogues_dir 
    8198        self.dialogues = {} 
    8299        self.agent_import_files = {} 
    83         self.settings = settings 
    84100        self.obj_loader = XMLObjectLoader( 
    85101                                          self.engine.getImagePool(),  
     
    289305        @param position: X,Y coordinates passed from engine.changeMap 
    290306        @return: fife.Location""" 
    291         print position 
     307        logging.debug(position) 
    292308        coord = fife.DoublePoint3D(float(position[0]), float(position[1]), 0) 
    293309        location = fife.Location(self.active_map.agent_layer) 
     
    458474        map_obj = self.fife_model.getObject(str(object_id), "PARPG") 
    459475        if not map_obj: 
    460             print ''.join(['Object with inst_id=', str(object_id),  
    461                            ' ns=PARPG', \ 
    462                            ' could not be found. Omitting...']) 
     476            logging.warning("Object with inst_id={0}, ns=PARPG, " 
     477                                  "could not be found. " 
     478                                  "Omitting...".format(str(obj_id))) 
    463479 
    464480        x_pos = agent["Position"][0] 
     
    647663        self.game_state.player_character = player_char 
    648664        self.game_state.player_character.setup()         
     665        self.game_state.player_character.behaviour.speed = self.settings.parpg.PCSpeed 
     666 
    649667 
    650668    def addObject(self, layer, obj): 
     
    671689            # create the agent 
    672690            obj.setup() 
     691            obj.behaviour.speed = self.settings.parpg.PCSpeed - 1 
    673692            # create the PlayerCharacter agent 
    674693            obj.start() 
     
    719738    def getAgentImportFiles(self): 
    720739        """Searches the agents directory for import files """ 
    721         files = locateFiles("*.xml", self.agents_directory) 
     740        files = locateFiles("*.xml", self.objects_directory) 
    722741        for xml_file in files: 
    723742            xml_file = os.path.relpath(xml_file).replace("\\", "/") 
     
    728747            except SyntaxError as error: 
    729748                assert(isinstance(error, SyntaxError)) 
    730                 print "Error parsing file " + xml_file + ": " + error.msg 
    731                 #TODO: We may want to make this an fatal error later. 
     749                logging.critical("Error parsing file {0}: " 
     750                                       "{1}".format(xml_file, error.msg)) 
     751                sys.exit(1) 
    732752     
    733753    def getDialogues(self): 
  • trunk/game/parpg/gamescenecontroller.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    2826 
    2927from controllerbase import ControllerBase 
    30 from scripts.gui.hud import Hud 
    31 from scripts.gui import drag_drop_data as data_drag 
     28from parpg.gui.hud import Hud 
     29from parpg.gui import drag_drop_data as data_drag 
    3230from objects.action import ChangeMapAction, ExamineAction, OpenBoxAction, \ 
    3331                           UnlockBoxAction, LockBoxAction, TalkAction, \ 
     
    3937    from gamemodel import GameModel 
    4038    from parpg import PARPGApplication 
     39 
     40import logging 
     41 
     42logger = logging.getLogger('gamescenecontroller') 
    4143 
    4244class GameSceneController(ControllerBase): 
     
    5456        @type engine: fife.Engine 
    5557        @param view: Instance of a GameSceneView 
    56         @param type: scripts.GameSceneView 
     58        @param type: parpg.GameSceneView 
    5759        @param model: The model that has the current gamestate 
    58         @type model: scripts.GameModel 
     60        @type model: parpg.GameModel 
    5961        @param application: The application that created this controller 
    60         @type application: scripts.PARPGApplication 
     62        @type application: parpg.PARPGApplication 
    6163        @param settings: The current settings of the application 
    6264        @type settings: fife.extensions.fife_settings.Setting 
     
    9193        self.paused = False 
    9294 
    93         if model.settings.get("FIFE",  "PlaySounds"): 
     95        if model.settings.fife.EnableSound: 
    9496            if not self.view.sounds.music_init: 
    9597                music_file = random.choice(glob.glob(os.path.join( 
     
    131133            self.model.active_map.toggleRenderer('CoordinateRenderer') 
    132134        if(key_val == key.F7): 
    133             # F7 saves a screenshot to fife/clients/parpg/screenshots 
    134              
    135             screenshot_file = "screenshots/screen-%s.png" % \ 
    136                     (datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) 
    137             print "PARPG: Saved:", screenshot_file 
     135            # F7 saves a screenshot to screenshots directory 
     136 
     137            settings = self.model.settings 
     138            screenshot_directory = os.path.join(settings.user_path, 
     139                                           settings.parpg.ScreenshotsDirectory) 
     140            # try to create the screenshots directory 
     141            try: 
     142                os.mkdir(screenshot_directory) 
     143            #TODO: distinguish between already existing permissions error 
     144            except OSError: 
     145                logger.warning("screenshot directory wasn't created.") 
     146 
     147            screenshot_file = os.path.join(screenshot_directory, 
     148                                           'screen-{0}.png'.format( 
     149                                           datetime.now().strftime( 
     150                                           '%Y-%m-%d-%H-%M-%S'))) 
    138151            self.engine.getRenderBackend().captureScreen(screenshot_file) 
     152            logger.info("PARPG: Saved: {0}".format(screenshot_file)) 
    139153        if(key_val == key.F10): 
    140154            # F10 shows/hides the console 
     
    243257                direction[0] += 1 
    244258                direction[1] -= 1 
    245                 image = settings.get("PARPG", "CursorUp") 
     259                image = os.path.join(settings.system_path, 
     260                                     settings.parpg.GuiDirectory, 
     261                                     settings.parpg.CursorDirectory, 
     262                                     settings.parpg.CursorUp) 
    246263                 
    247264            #right 
     
    249266                direction[0] += 1 
    250267                direction[1] += 1 
    251                 image = settings.get("PARPG", "CursorRight") 
     268                image = os.path.join(settings.system_path, 
     269                                     settings.parpg.GuiDirectory, 
     270                                     settings.parpg.CursorDirectory, 
     271                                     settings.parpg.CursorRight) 
    252272                 
    253273            #down 
     
    255275                direction[0] -= 1 
    256276                direction[1] += 1 
    257                 image = settings.get("PARPG", "CursorDown") 
     277                image = os.path.join(settings.system_path, 
     278                                     settings.parpg.GuiDirectory, 
     279                                     settings.parpg.CursorDirectory, 
     280                                     settings.parpg.CursorDown) 
    258281                 
    259282            #left 
     
    261284                direction[0] -= 1 
    262285                direction[1] -= 1 
    263                 image = settings.get("PARPG", "CursorLeft") 
     286                image = os.path.join(settings.system_path, 
     287                                     settings.parpg.GuiDirectory, 
     288                                     settings.parpg.CursorDirectory, 
     289                                     settings.parpg.CursorLeft) 
    264290             
    265             if image != None and not data_drag.dragging: 
     291            if image is not None and not data_drag.dragging: 
    266292                self.setMouseCursor(image, image) 
    267293        
     
    301327    def nullFunc(self, userdata): 
    302328        """Sample callback for the context menus.""" 
    303         print userdata     
     329        logger.info(userdata) 
    304330 
    305331    def initTalk(self, npc_info): 
  • trunk/game/parpg/gamesceneview.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/gamestate.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1614#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1715 
    18 from scripts.quest_engine import QuestEngine 
     16from parpg.quest_engine import QuestEngine 
    1917 
    2018class GameState(object): 
  • trunk/game/parpg/gui/actionsbox.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/gui/containergui.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This program is free software: you can redistribute it and/or modify 
    42#   it under the terms of the GNU General Public License as published by 
     
    1513from fife.extensions.pychan.tools import callbackWithArguments as cbwa 
    1614 
    17 from scripts.gui.containergui_base import ContainerGUIBase 
    18 from scripts.gui import drag_drop_data as data_drag 
    19 from scripts.objects.base import Container 
     15from parpg.gui.containergui_base import ContainerGUIBase 
     16from parpg.gui import drag_drop_data as data_drag 
     17from parpg.objects.base import Container 
    2018 
    2119class ContainerGUI(ContainerGUIBase): 
  • trunk/game/parpg/gui/containergui_base.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This program is free software: you can redistribute it and/or modify 
    42#   it under the terms of the GNU General Public License as published by 
     
    1715from fife.extensions import pychan 
    1816 
    19 from scripts.gui import drag_drop_data as data_drag 
    20 from scripts.objects.action import ACTIONS 
     17from parpg.gui import drag_drop_data as data_drag 
     18from parpg.objects.action import ACTIONS 
    2119from copy import deepcopy 
    2220 
     
    117115        """Executes the items action 
    118116        @param action: The action to run 
    119         @type action: Class derived from scripts.objects.action.Action 
     117        @type action: Class derived from parpg.objects.action.Action 
    120118        """ 
    121119        action.execute() 
  • trunk/game/parpg/gui/dialogs.py

    r791 r818  
    1 #/usr/bin/python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1614#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1715 
    18 """ 
    19 This contains the data that tells the GUI whether something is being dragged, dropped etc. 
    20 It is in one place to allow communication between multiple windows 
    21 """ 
    22 dragging = False 
    23 dragged_image = None 
    24 dragged_type = None 
    25 dragged_item = None 
    26 dragged_widget = None 
    27 source_container = None 
     16from fife.extensions import pychan 
     17 
     18class RestartDialog(object): 
     19    def __init__(self): 
     20        self.window = pychan.loadXML('gui/restart_dialog.xml') 
     21        self.window.mapEvents({'closeButton': self.hide}) 
     22 
     23    def hide(self): 
     24        self.window.hide() 
     25 
     26    def show(self): 
     27        self.window.show() 
  • trunk/game/parpg/gui/dialoguegui.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    2119from fife.extensions.pychan import widgets 
    2220 
    23 from scripts.dialogueprocessor import DialogueProcessor 
     21from parpg.dialogueprocessor import DialogueProcessor 
    2422 
    25 def setupLogging(): 
    26     """Set various logging parameters for this module.""" 
    27     module_logger = logging.getLogger('dialoguegui') 
    28     if (__debug__): 
    29         module_logger.setLevel(logging.DEBUG) 
    30 setupLogging() 
     23logger = logging.getLogger('dialoguegui') 
    3124 
    3225class DialogueGUI(object): 
  • trunk/game/parpg/gui/drag_drop_data.py

    r791 r818  
    1 #/usr/bin/python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/gui/filebrowser.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This program is free software: you can redistribute it and/or modify 
    42#   it under the terms of the GNU General Public License as published by 
     
    1816 
    1917import sys 
     18import os 
     19import logging 
     20 
     21logger = logging.getLogger('filebrowser') 
    2022 
    2123def u2s(string): 
     
    3133       doesn't exist yet. The select_dir option allows directories to be 
    3234       selected as well as files.""" 
    33     def __init__(self, engine, file_selected, close_callback = None, save_file=False, \ 
    34                  select_dir=False, extensions=('.dat',), \ 
    35                  gui_xml_path="gui/filebrowser.xml"): 
     35    def __init__(self, engine, settings, file_selected, gui_xml_path, 
     36                 close_callback=None, save_file=False, select_dir=False,  
     37                 extensions=('.dat',)): 
    3638        self.engine = engine 
     39        self.settings = settings 
     40        print self.settings.parpg.SavesDirectory 
    3741        self.file_selected = file_selected 
    3842 
     
    4145        self.select_dir = select_dir 
    4246        self.close_callback = close_callback 
     47        self.gui_xml_path = gui_xml_path  
    4348         
    44         self.gui_xml_path = gui_xml_path 
    45  
    4649        self.extensions = extensions 
    47         self.path = './saves/' 
     50        self.path = os.path.join(self.settings.user_path, 
     51                                 self.settings.parpg.SavesDirectory) 
    4852        self.dir_list = [] 
    4953        self.file_list = [] 
     
    9599                except: 
    96100                    new_list.append(unicode(i, fs_encoding, 'replace')) 
    97                     print "WARNING: Could not decode item:", i 
     101                    logger.debug("WARNING: Could not decode item:\n" 
     102                                        "{0}".format(i)) 
    98103            return new_list 
    99104             
     
    141146            return 
    142147 
    143         print 'FileBrowser: error, no selection.' 
     148        logger.error('no selection') 
    144149 
    145150    def _warningMessage(self): 
  • trunk/game/parpg/gui/hud.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1614#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1715 
     16import os 
     17import logging 
     18 
    1819from fife.extensions import pychan 
    1920from fife.extensions.pychan.tools import callbackWithArguments as cbwa 
    2021 
    21 from scripts.gui.filebrowser import FileBrowser 
    22 from scripts.gui.context_menu import ContextMenu 
    23 from scripts.gui import inventorygui 
    24 from scripts.gui.popups import ExaminePopup 
    25 from scripts.gui.containergui import ContainerGUI 
    26 from scripts.gui.dialoguegui import DialogueGUI 
    27 from scripts.gui import drag_drop_data as data_drag 
     22from parpg.gui.filebrowser import FileBrowser 
     23from parpg.gui.menus import ContextMenu, SettingsMenu 
     24from parpg.gui import inventorygui 
     25from parpg.gui.popups import ExaminePopup 
     26from parpg.gui.containergui import ContainerGUI 
     27from parpg.gui.dialoguegui import DialogueGUI 
     28from parpg.gui import drag_drop_data as data_drag 
    2829from actionsbox import ActionsBox 
    2930 
     31logger = logging.getLogger('hud') 
    3032class Hud(object): 
    3133    """Main Hud class""" 
     
    7779        self.initializeEvents() 
    7880        self.initializeQuitDialog() 
     81        self.initializeSettingsMenu() 
    7982     
    8083    def _getEnabled(self): 
     
    149152    def initializeInventory(self): 
    150153        """Initialize the inventory""" 
    151         inv_callbacks = { 
    152             'refreshReadyImages': self.refreshReadyImages, 
    153             'toggleInventoryButton': self.toggleInventoryButton, 
    154         } 
    155         self.inventory_storage = \ 
    156             self.model.game_state.player_character.inventory 
    157         if self.inventory == None: 
     154        if not self.inventory: 
    158155            self.inventory = inventorygui.InventoryGUI(self.controller, 
    159                                                        self.inventory_storage, 
    160                                                        inv_callbacks) 
    161         else: 
    162             self.inventory.inventory_storage = self.inventory_storage 
    163         self.refreshReadyImages() 
     156                                                       None, 
     157                                                       None) 
     158#        inv_callbacks = { 
     159#            'refreshReadyImages': self.refreshReadyImages, 
     160#            'toggleInventoryButton': self.toggleInventoryButton, 
     161#        } 
     162#        self.inventory_storage = \ 
     163#            self.model.game_state.player_character.inventory 
     164#        if self.inventory == None: 
     165#            self.inventory = inventorygui.InventoryGUI(self.controller, 
     166#                                                       self.inventory_storage, 
     167#                                                       inv_callbacks) 
     168#        else: 
     169#            self.inventory.inventory_storage = self.inventory_storage 
     170#        self.refreshReadyImages() 
    164171     
    165172    def initializeCharacterScreen(self): 
     
    174181           @return: None""" 
    175182        self.context_menu = ContextMenu (self.engine, [], (0, 0)) 
    176         self.context_menu.hide() 
    177183 
    178184    def showContextMenu(self, data, pos): 
     
    184190           @return: None""" 
    185191        self.context_menu = ContextMenu(self.engine, data, pos) 
     192        self.context_menu.show() 
    186193 
    187194    def hideContextMenu(self): 
     
    194201           @return: None""" 
    195202        self.main_menu = pychan.loadXML("gui/hud_pause_menu.xml") 
    196         self.menu_events = {"resumeButton":self.hideMenu,  
    197                             "optionsButton":self.settings.onOptionsPress, 
    198                             "helpButton":self.displayHelp} 
     203        #TODO: find more suitalbe place for onOptilonsPress implementation 
     204        self.menu_events = {"resumeButton": self.hideMenu,  
     205                            "settingsButton": self.displaySettings, 
     206                            "helpButton": self.displayHelp} 
    199207        self.main_menu.mapEvents(self.menu_events) 
    200208 
     
    221229        self.enabled = True 
    222230 
     231    def initializeSettingsMenu(self): 
     232        self.settings_menu = SettingsMenu(self.engine, self.settings) 
     233 
     234    def displaySettings(self): 
     235        self.settings_menu.show() 
    223236 
    224237    def initializeHelpMenu(self): 
     
    242255        k_text += "[br] A : Add a test action to the actions display" 
    243256        k_text += "[br] I : Toggle the inventory screen" 
    244         k_text += "[br] F5 : Take a screenshot" 
    245         k_text += "[br]      (saves to <parpg>/screenshots/)" 
     257        k_text += "[br] F7 : Take a screenshot" 
     258        k_text += "[br]      (Saves to screenshots directory)" 
    246259        k_text += "[br] F10 : Toggle console" 
    247260        k_text += "[br] PAUSE : (Un)Pause the game" 
     
    261274            @return: None""" 
    262275        self.stopActions() 
     276        xml_path = os.path.join(self.settings.system_path, 
     277                                    self.settings.parpg.GuiDirectory, 
     278                                    'savebrowser.xml') 
    263279        save_browser = FileBrowser(self.engine, 
     280                                   self.settings, 
    264281                                   self.save_game_callback, 
     282                                   xml_path, 
    265283                                   self.loadsave_close, 
    266284                                   save_file=True, 
    267                                    gui_xml_path="gui/savebrowser.xml", 
    268                                    extensions = ('.dat')) 
     285                                   extensions=('.dat')) 
    269286        save_browser.showBrowser() 
    270287        self.controller.pause(True) 
     
    289306           @return: None""" 
    290307        self.stopActions() 
    291         print 'new game' 
     308        logger.info('new game') 
    292309     
    293310    def loadsave_close(self): 
     
    302319            @return: None""" 
    303320        self.stopActions() 
     321        xml_path = os.path.join(self.settings.system_path, 
     322                                    self.settings.parpg.GuiDirectory, 
     323                                    'loadbrowser.xml') 
    304324        load_browser = FileBrowser(self.engine, 
     325                                   self.settings, 
    305326                                   self.load_game_callback, 
     327                                   xml_path, 
    306328                                   close_callback = self.loadsave_close, 
    307329                                   save_file=False, 
    308                                    gui_xml_path='gui/loadbrowser.xml', 
    309330                                   extensions=('.dat')) 
    310331        load_browser.showBrowser() 
     
    424445        self.main_menu.mapEvents(menu_events) 
    425446 
    426     def setOption(self, name, value): 
    427         """Set an option within the xml. 
    428            @type name: string 
    429            @param name: The name of the option within the xml 
    430            @type value: any 
    431            @param value: The value that the option 'name' should be set to 
    432            @return: None""" 
    433         element = self.settings.root_element.find(name) 
    434         if(element != None): 
    435             if(value != element.text): 
    436                 element.text = str(value) 
    437         else: 
    438             print 'Setting,', name, 'does not exist!' 
    439      
    440447    def readyAction(self, ready_button): 
    441448        """ Called when the user selects a ready button from the HUD """ 
  • trunk/game/parpg/gui/inventorygui.py

    r791 r818  
    1717 
    1818from fife.extensions.pychan.tools import callbackWithArguments as cbwa 
    19  
    20 from scripts.gui import drag_drop_data as data_drag 
    21 from scripts.objects.base import Container 
    22 from scripts.gui.containergui_base import ContainerGUIBase 
    23 from scripts.objects.action import ACTIONS 
     19from fife.extensions import pychan 
     20from fife.extensions.pychan.attrs import UnicodeAttr 
     21 
     22from parpg.gui import drag_drop_data as data_drag 
     23from parpg.objects.base import Container 
     24from parpg.gui.containergui_base import ContainerGUIBase 
     25from parpg.objects.action import ACTIONS 
     26 
     27import logging 
     28 
     29logger = logging.getLogger('action') 
     30 
     31class EquipmentSlot(pychan.VBox): 
     32    ATTRIBUTES = pychan.VBox.ATTRIBUTES + [UnicodeAttr('label_text')] 
     33     
     34    def _setLabelText(self, text): 
     35        label = self.findChild() 
     36        label.text = unicode(text) 
     37        label.resizeToContent() 
     38        self.margins = ( 
     39            int((self.width - label.width) / 2.0), 
     40            int((self.height - label.height) / 2.0) 
     41        ) 
     42     
     43    def _getLabelText(self): 
     44        label = self.findChild() 
     45        return label.text 
     46     
     47    label_text = property(fget=_getLabelText, fset=_setLabelText) 
     48     
     49    def __init__(self, label_text=u'equipment', min_size=(50, 50), 
     50                 max_size=(50, 50), margins=None, 
     51                 background_image="gui/inv_images/inv_background.png", 
     52                 **kwargs): 
     53        pychan.VBox.__init__(self, min_size=min_size, max_size=max_size, 
     54                             **kwargs) 
     55        self.background_image = background_image 
     56        label = pychan.Label(text=unicode(label_text)) 
     57        self.addChild(label) 
     58        self.label_text = label_text 
     59        self.adaptLayout() 
     60        if self.parent is not None: 
     61            self.beforeShow() 
     62 
     63 
     64class InventoryGrid(pychan.VBox): 
     65    ATTRIBUTES = pychan.VBox.ATTRIBUTES + [pychan.attrs.PointAttr('grid_size')] 
     66     
     67    def _setNColumns(self, n_columns): 
     68        n_rows = self.grid_size[1] 
     69        self.grid_size = (n_columns, n_rows) 
     70     
     71    def _getNColumns(self): 
     72        n_columns = self.grid_size[0] 
     73        return n_columns 
     74    n_columns = property(fget=_getNColumns, fset=_setNColumns) 
     75     
     76    def _setNRows(self, n_rows): 
     77        n_columns = self.grid_size[0] 
     78        self.grid_size = (n_columns, n_rows) 
     79     
     80    def _getNRows(self): 
     81        n_rows = self.grid_size[1] 
     82        return n_rows 
     83    n_rows = property(fget=_getNRows, fset=_getNColumns) 
     84     
     85    def _setGridSize(self, grid_size): 
     86        n_columns, n_rows = grid_size 
     87        self.removeAllChildren() 
     88        for row_n in range(n_rows): 
     89            row_size = (n_columns * 50, 50) 
     90            row = pychan.HBox(min_size=row_size, max_size=row_size, 
     91                              padding=self.padding) 
     92            row.border_size = 1 
     93            row.opaque = 0 
     94            for column_n in range(n_columns): 
     95                slot = pychan.Icon(min_size=(50, 50), max_size=(50, 50)) 
     96                slot.border_size = 1 
     97                row.addChild(slot) 
     98            self.addChild(row) 
     99        self.min_size = ((n_columns * 50) + 2, (n_rows * 50) + 2) 
     100        self.max_size = self.min_size 
     101     
     102    def _getGridSize(self): 
     103        n_rows = len(self.children) 
     104        n_columns = len(self.children[0].children) 
     105        return (n_rows, n_columns) 
     106    grid_size = property(fget=_getGridSize, fset=_setGridSize) 
     107     
     108    def __init__(self, grid_size=(2, 2), padding=0, **kwargs): 
     109        pychan.VBox.__init__(self, padding=padding, **kwargs) 
     110        self.opaque = 0 
     111        self.grid_size = grid_size 
     112        self.border_size = 1 
     113 
    24114 
    25115class InventoryGUI(ContainerGUIBase): 
     116    def __init__(self, controller, inventory, callbacks): 
     117        super(InventoryGUI, self).__init__(controller, "gui/inventory.xml") 
     118        self.engine = controller.engine 
     119        self.inventory_shown = False 
     120        render_backend = self.engine.getRenderBackend() 
     121        screen_mode = render_backend.getCurrentScreenMode() 
     122        screen_width, screen_height = (screen_mode.getWidth(), 
     123                                       screen_mode.getHeight()) 
     124        widget_width, widget_height = self.gui.size 
     125        self.gui.position = ((screen_width - widget_width) / 2, 
     126                             (screen_height - widget_height) / 2) 
     127     
     128    def toggleInventory(self, toggleImage=True): 
     129        """Pause the game and enter the inventory screen, or close the 
     130           inventory screen and resume the game. 
     131           @type toggleImage: bool 
     132           @param toggleImage: 
     133               Call toggleInventoryCallback if True. Toggling via a 
     134               keypress requires that we toggle the Hud inventory image 
     135               explicitly. Clicking on the Hud inventory button toggles the 
     136               image implicitly, so we don't change it. 
     137           @return: None""" 
     138        if not self.inventory_shown: 
     139            self.showInventory() 
     140            self.inventory_shown = True 
     141        else: 
     142            self.closeInventory() 
     143            self.inventory_shown = False 
     144     
     145    def showInventory(self): 
     146        self.gui.show() 
     147     
     148    def closeInventory(self): 
     149        self.gui.hide() 
     150 
     151 
     152class _InventoryGUI(ContainerGUIBase): 
    26153    """Inventory GUI class""" 
    27154    def __init__(self, controller, inventory, callbacks): 
     
    210337                data_drag.dragging = False 
    211338        except Container.TooBig : 
    212             print("%s too big to fit into %s" % (data_drag.dragged_item, 
    213                                                  drop_widget.slot)) 
     339            logger.warning("%s too big to fit " 
     340                                 "into %s" % (data_drag.dragged_item, 
     341                                              drop_widget.slot)) 
    214342        except (Container.SlotBusy, Container.ItemSelf): 
    215343            pass 
  • trunk/game/parpg/inventory.py

    r791 r818  
    1414# along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1515 
    16 from scripts.objects.base import Container 
    17 from scripts.objects.composed import SingleItemContainer as Slot 
     16from parpg.objects.base import Container 
     17from parpg.objects.composed import SingleItemContainer as Slot 
    1818 
    1919import copy 
  • trunk/game/parpg/mainmenucontroller.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    2422#For debugging/code analysis 
    2523if False: 
    26     from scripts.mainmenuview import MainMenuView 
     24    from parpg.mainmenuview import MainMenuView 
    2725    from fife import fife 
    2826    from gamemodel import GameModel 
     
    3432    def __init__(self, engine, view, model, application): 
    3533        """Constructor""" 
    36         ControllerBase.__init__(self, engine, view, model, application) 
     34        super(MainMenuController, self).__init__(engine, view, model,  
     35                                                 application) 
    3736     
    3837        #this can be helpful for IDEs code analysis 
     
    9493           @return: None""" 
    9594        self.application.listener.quitGame() 
    96  
    97  
  • trunk/game/parpg/mainmenuview.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1614#   along with PARPG.  If not, see <http://www.gnu.org/licenses/ 
    1715 
     16import os 
     17 
    1818from fife.extensions import pychan 
    1919 
    2020from viewbase import ViewBase 
    21 from scripts.gui.filebrowser import FileBrowser 
     21from parpg.gui.filebrowser import FileBrowser 
     22from parpg.gui.menus import SettingsMenu 
    2223 
    2324class MainMenuView(ViewBase): 
     
    6667        menu_events["newButton"] = self.newGame 
    6768        menu_events["loadButton"] = self.loadGame 
    68         menu_events["optionsButton"] = self.model.settings.onOptionsPress 
     69        menu_events["settingsButton"] = self.displaySettings 
    6970        menu_events["quitButton"] = self.quitGame 
    7071        self.main_menu.mapEvents(menu_events) 
    7172         
    7273        self.initializeQuitDialog() 
     74        self.initializeSettingsMenu() 
    7375     
    7476    def newGame(self): 
     
    8082        """ Called when the user wants to load a game. 
    8183            @return: None""" 
     84        xml_path = os.path.join(self.model.settings.system_path, 
     85                                self.model.settings.parpg.GuiDirectory, 
     86                                'loadbrowser.xml') 
    8287        load_browser = FileBrowser(self.engine, 
     88                                   self.model.settings, 
    8389                                   self.load_game_callback, 
     90                                   gui_xml_path=xml_path, 
    8491                                   save_file=False, 
    85                                    gui_xml_path='gui/loadbrowser.xml', 
    8692                                   extensions=('.dat')) 
    8793        load_browser.showBrowser() 
     
    9096        """Creates the quit confirmation dialog 
    9197           @return: None""" 
     98         
    9299        self.quit_window = pychan.widgets.Window(title=unicode("Quit?"), \ 
    93100                                                 min_size=(200,0)) 
     
    120127           @return: None""" 
    121128        self.quit_window.show() 
    122      
     129 
     130    def initializeSettingsMenu(self): 
     131        self.settings_menu = SettingsMenu(self.engine, self.model.settings) 
     132 
     133    def displaySettings(self): 
     134        self.settings_menu.show() 
  • trunk/game/parpg/objects/__init__.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/objects/action.py

    r791 r818  
    1 #!/usr/bin/env python 
    21#   This file is part of PARPG. 
    32 
     
    1716#exceptions 
    1817 
    19 from scripts.gui import drag_drop_data as data_drag 
     18import logging 
     19 
     20logger = logging.getLogger('action') 
     21 
     22from parpg.gui import drag_drop_data as data_drag 
    2023 
    2124class NoSuchQuestException(Exception): 
     
    3235        """Basic action constructor 
    3336        @param controller: A reference to the GameSceneController. 
    34         @type controller: scripts.GameSceneController 
     37        @type controller: parpg.GameSceneController 
    3538        @param commands: Special commands that are executed 
    3639        @type commands: Dictionary  
     
    6164class ChangeMapAction(Action): 
    6265    """A change map scheduled""" 
    63     def __init__(self, controller, target_map_name, target_pos, commands = None): 
     66    def __init__(self, controller, target_map_name, target_pos, commands=None): 
    6467        """Initiates a change of the position of the character 
    6568        possibly flagging a new map to be loaded. 
    6669        @param controller: A reference to the GameSceneController. 
    67         @type controller: scripts.GameSceneController 
    68         @param commands: Special commands that are executed 
    69         @type commands: Dictionary  
    70         @type view: class derived from scripts.ViewBase 
     70        @type controller: parpg.GameSceneController 
     71        @param commands: Special commands that are executed 
     72        @type commands: Dictionary  
     73        @type view: class derived from parpg.ViewBase 
    7174        @param view: The view 
    7275        @type target_map_name: String 
     
    8891class OpenAction(Action): 
    8992    """Open a container""" 
    90     def __init__(self, controller, container, commands = None): 
    91         """ 
    92         @param controller: A reference to the GameSceneController. 
    93         @type controller: scripts.GameSceneController 
    94         @param commands: Special commands that are executed 
    95         @type commands: Dictionary  
    96         @type view: class derived from scripts.ViewBase 
     93    def __init__(self, controller, container, commands=None): 
     94        """ 
     95        @param controller: A reference to the GameSceneController. 
     96        @type controller: parpg.GameSceneController 
     97        @param commands: Special commands that are executed 
     98        @type commands: Dictionary  
     99        @type view: class derived from parpg.ViewBase 
    97100        @param view: The view 
    98101        @param container: A reference to the container 
     
    113116        """ 
    114117        @param controller: A reference to the GameSceneController. 
    115         @type controller: scripts.GameSceneController 
    116         @param commands: Special commands that are executed 
    117         @type commands: Dictionary  
    118         @type view: class derived from scripts.ViewBase 
     118        @type controller: parpg.GameSceneController 
     119        @param commands: Special commands that are executed 
     120        @type commands: Dictionary  
     121        @type view: class derived from parpg.ViewBase 
    119122        @param view: The view 
    120123        @param container: A reference to the container 
     
    139142        """ 
    140143        @param controller: A reference to the GameSceneController. 
    141         @type controller: scripts.GameSceneController 
     144        @type controller: parpg.GameSceneController 
    142145        @param commands: Special commands that are executed 
    143146        @type commands: Dictionary  
     
    157160        """ 
    158161        @param controller: A reference to the GameSceneController. 
    159         @type controller: scripts.GameSceneController 
     162        @type controller: parpg.GameSceneController 
    160163        @param commands: Special commands that are executed 
    161164        @type commands: Dictionary  
     
    173176class ExamineAction(Action): 
    174177    """Examine an object.""" 
    175     def __init__(self, controller, examine_id, examine_name, examine_desc, commands = None): 
    176         """ 
    177         @param controller: A reference to the GameSceneController. 
    178         @type controller: scripts.GameSceneController 
     178    def __init__(self, controller, examine_id, examine_name, examine_desc=None, commands=None): 
     179        """ 
     180        @param controller: A reference to the GameSceneController. 
     181        @type controller: parpg.GameSceneController 
    179182        @param examine_id: An object id 
    180183        @type examine_id: integer 
     
    185188        @param commands: Special commands that are executed 
    186189        @type commands: Dictionary  
    187         @type view: class derived from scripts.ViewBase 
     190        @type view: class derived from parpg.ViewBase 
    188191        @param view: The view 
    189192         
     
    193196        self.examine_id = examine_id 
    194197        self.examine_name = examine_name 
    195         self.examine_desc = examine_desc 
     198        if examine_desc is not None: 
     199            self.examine_desc = examine_desc 
     200        else: 
     201            self.examine_desc = "No Description" 
    196202         
    197203    def execute(self): 
     
    199205        action_text = self.examine_desc 
    200206        self.view.hud.addAction(unicode(action_text)) 
    201         print action_text 
     207        logger.debug(action_text) 
    202208        #this code will cut the line up into smaller lines that will be displayed 
    203209        place = 25 
     
    214220        """ 
    215221        @param controller: A reference to the GameSceneController. 
    216         @type controller: scripts.GameSceneController 
    217         @param commands: Special commands that are executed 
    218         @type commands: Dictionary  
    219         @type view: class derived from scripts.ViewBase 
     222        @type controller: parpg.GameSceneController 
     223        @param commands: Special commands that are executed 
     224        @type commands: Dictionary  
     225        @type view: class derived from parpg.ViewBase 
    220226        @param view: The view 
    221227        @type examine_name: String 
     
    233239        action_text = unicode(self.examine_desc) 
    234240        self.view.hud.addAction(action_text) 
    235         print action_text 
     241        logger.debug(action_text) 
    236242 
    237243class ReadAction(Action): 
     
    240246        """ 
    241247        @param controller: A reference to the GameSceneController. 
    242         @type controller: scripts.GameSceneController 
    243         @param commands: Special commands that are executed 
    244         @type commands: Dictionary  
    245         @param view: The view 
    246         @type view: class derived from scripts.ViewBase 
     248        @type controller: parpg.GameSceneController 
     249        @param commands: Special commands that are executed 
     250        @type commands: Dictionary  
     251        @param view: The view 
     252        @type view: class derived from parpg.ViewBase 
    247253        @param text_name: Name of the object containing the text 
    248254        @type text_name: String 
     
    260266                                         self.text])) 
    261267        self.view.hud.addAction(action_text) 
    262         print action_text 
     268        logger.debug(action_text) 
    263269        super(ReadAction, self).execute() 
    264270 
     
    268274        """ 
    269275        @param controller: A reference to the GameSceneController. 
    270         @type controller: scripts.GameSceneController 
    271         @param commands: Special commands that are executed 
    272         @type commands: Dictionary  
    273         @type view: class derived from scripts.ViewBase 
     276        @type controller: parpg.GameSceneController 
     277        @param commands: Special commands that are executed 
     278        @type commands: Dictionary  
     279        @type view: class derived from parpg.ViewBase 
    274280        @param view: The view 
    275281        @type npc: NonPlayerCharacter 
     
    283289        """Talk with the NPC when close enough, otherwise move closer. 
    284290           @return: None""" 
    285         from scripts.dialoguecontroller import DialogueController 
     291        from parpg.dialoguecontroller import DialogueController 
    286292         
    287293        player_char = self.model.game_state.player_character 
     
    328334        """ 
    329335        @param controller: A reference to the GameSceneController. 
    330         @type controller: scripts.GameSceneController 
     336        @type controller: parpg.GameSceneController 
    331337        @param item: Item on which the action is called 
    332338        @type item: CarryableItem 
  • trunk/game/parpg/objects/actors.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    2321from base import GameObject, Living, Scriptable, CharStats 
    2422from composed import CarryableItem 
    25 from scripts.inventory import Inventory 
    26 from scripts.common.utils import loadSettings 
     23from parpg.inventory import Inventory 
    2724 
    2825"""All actors go here. Concrete classes only.""" 
    2926 
    30 __all__ = ["PlayerCharacter", "NonPlayerCharacter",] 
    31  
    32 Settings = loadSettings() 
     27__all__ = ["PlayerCharacter", "NonPlayerCharacter", ] 
    3328 
    3429_AGENT_STATE_NONE, _AGENT_STATE_IDLE, _AGENT_STATE_APPROACH, _AGENT_STATE_RUN, _AGENT_STATE_WANDER, _AGENT_STATE_TALK = xrange(6) 
     
    5247        self.agent.addActionListener(self) 
    5348        self.state = _AGENT_STATE_NONE 
    54         # TODO: rework/improve 
    55         self.speed = Settings.get("PARPG", "PCSpeed")-1 
    5649         
    5750    def getX(self): 
     
    8679 
    8780class PCBehaviour (ActorBehaviour): 
    88     def __init__(self, parent = None, layer = None): 
     81    def __init__(self, parent=None, layer=None): 
    8982        super(PCBehaviour, self).__init__(layer)         
    9083        self.parent = parent 
    9184        self.idle_counter = 1 
    92         # TODO: rework/improve 
    93         self.speed = Settings.get("PARPG", "PCSpeed") 
     85        self.speed = 0 
    9486        self.nextAction = None 
    9587        self.agent = None 
     
    116108 
    117109class NPCBehaviour(ActorBehaviour): 
    118     def __init__(self, Parent = None, Layer = None): 
     110    def __init__(self, Parent=None, Layer=None): 
    119111        super(NPCBehaviour, self).__init__(Layer) 
    120112         
     
    193185            self.agent.act('stand', self.pc.getLocation()) 
    194186             
    195 class CharacterBase(GameObject, Living, CharStats): 
     187class CharacterBase(GameObject, CharStats, Living): 
    196188    """Base class for Characters""" 
    197     def __init__(self, ID, agent_layer = None, inventory = None,  
    198                  text = "", **kwargs): 
    199         GameObject.__init__( self, ID, text = text, **kwargs ) 
    200         Living.__init__( self, **kwargs ) 
    201         CharStats.__init__( self, **kwargs ) 
    202          
     189    def __init__(self, ID, agent_layer=None, inventory=None, text="", 
     190                 primary_stats=None, secondary_stats=None, **kwargs): 
     191        GameObject.__init__(self, ID, text=text, **kwargs) 
     192        CharStats.__init__(self, **kwargs) 
     193        Living.__init__(self, **kwargs) 
     194        self.statistics = {} 
     195        if primary_stats is not None: 
     196            for primary_stat in primary_stats: 
     197                name = primary_stat.name 
     198                self.statistics[name] = primary_stat 
     199        if secondary_stats is not None: 
     200            for secondary_stat in primary_stats: 
     201                long_name = secondary_stat.long_name 
     202                self.statistics[long_name] = secondary_stat 
     203                short_name = secondary_stat.short_name 
     204                self.statistics[short_name] = secondary_stat 
     205                secondary_stat.attach(self) 
    203206        self.behaviour = None 
    204          
    205207        if inventory == None: 
    206208            self.inventory = Inventory() 
    207209        else: 
    208210            self.inventory = inventory 
    209  
    210211        self.state = _AGENT_STATE_NONE 
    211212        self.layer_id = agent_layer.getId() 
     
    249250        @type item_type: str 
    250251        @return: True when the item is present, False when not""" 
    251         return self.inventory.findItem(item_type = item_type) 
    252  
    253     def itemCount(self, item_type = ""): 
     252        return self.inventory.findItem(item_type=item_type) 
     253 
     254    def itemCount(self, item_type=""): 
    254255        """Returns number of all items or items specified by item_type  
    255256        the player has. 
     
    273274        self.state = _AGENT_STATE_RUN 
    274275        self.behaviour.nextAction = None 
    275         self.behaviour.agent.move('run', location, self.behaviour.speed+1) 
     276        self.behaviour.agent.move('run', location, self.behaviour.speed + 1) 
    276277 
    277278    def walk(self, location): 
     
    282283        self.state = _AGENT_STATE_RUN 
    283284        self.behaviour.nextAction = None  
    284         self.behaviour.agent.move('walk', location, self.behaviour.speed-1) 
     285        self.behaviour.agent.move('walk', location, self.behaviour.speed - 1) 
    285286 
    286287    def getStateForSaving(self): 
     
    293294    def _getCoords(self): 
    294295        """Get-er property function""" 
    295         return (self.getLocation().getMapCoordinates().x,  
     296        return (self.getLocation().getMapCoordinates().x, 
    296297                self.getLocation().getMapCoordinates().y) 
    297298     
     
    302303        self.teleport(map_coords) 
    303304     
    304     coords = property (_getCoords, _setCoords,  
    305         doc = "Property allowing you to get and set the object's \ 
     305    coords = property (_getCoords, _setCoords, 
     306        doc="Property allowing you to get and set the object's \ 
    306307                coordinates via tuples") 
    307308            
    308309class PlayerCharacter (CharacterBase): 
    309310    """PC class""" 
    310     def __init__ (self, ID, agent_layer = None, inventory = None,  
    311                   text = "Its you. Who would've thought that?", **kwargs): 
     311    def __init__ (self, ID, agent_layer=None, inventory=None, 
     312                  text="Its you. Who would've thought that?", **kwargs): 
    312313        if inventory == None: 
    313314            inventory = Inventory() 
    314315            inventory.placeItem(CarryableItem(ID=456, name="Dagger123")) 
    315316            inventory.placeItem(CarryableItem(ID=555, name="Beer")) 
    316             inventory.placeItem(CarryableItem(ID = 616, 
    317                                     name = "Pamphlet", 
    318                                     image = "/gui/inv_images/inv_pamphlet.png")) 
     317            inventory.placeItem(CarryableItem(ID=616, 
     318                                    name="Pamphlet", 
     319                                    image="/gui/inv_images/inv_pamphlet.png")) 
    319320        CharacterBase.__init__(self, ID, agent_layer, inventory, text, **kwargs) 
    320321        self.people_i_know = set() 
     
    350351        self.behaviour = PCBehaviour(self, layer) 
    351352  
    352     def approach(self, location, action = None): 
     353    def approach(self, location, action=None): 
    353354        """Approaches a location and then perform an action (if set). 
    354355           @type loc: fife.Location 
     
    362363        l = fife.Location(self.behaviour.agent.getLocation()) 
    363364        l.setLayerCoordinates(fife.ModelCoordinate(*boxLocation)) 
    364         self.behaviour.agent.move('run', l, self.behaviour.speed+1) 
     365        self.behaviour.agent.move('run', l, self.behaviour.speed + 1) 
    365366     
    366367class NonPlayerCharacter(CharacterBase, Scriptable): 
    367368    """NPC class""" 
    368369    def __init__(self, ID, agent_layer=None, name='NPC', \ 
    369                  text = 'A nonplayer character', inventory = None,  
    370                  real_name = 'NPC', dialogue = None, **kwargs): 
     370                 text='A nonplayer character', inventory=None, 
     371                 real_name='NPC', dialogue=None, **kwargs): 
    371372        # init game object 
    372         CharacterBase.__init__(self, ID, agent_layer = agent_layer,  
    373                                inventory = inventory, name=name,  
    374                                real_name=real_name, text = text, **kwargs) 
     373        CharacterBase.__init__(self, ID, agent_layer=agent_layer, 
     374                               inventory=inventory, name=name, 
     375                               real_name=real_name, text=text, **kwargs) 
    375376        Scriptable.__init__(self, **kwargs) 
    376377 
     
    404405           @param location: Where the NPC will walk to. 
    405406           @return: None""" 
    406         self.behaviour.agent.move('walk', location, self.behaviour.speed-1) 
     407        self.behaviour.agent.move('walk', location, self.behaviour.speed - 1) 
    407408 
    408409    def talk(self, pc): 
  • trunk/game/parpg/objects/base.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    177175 
    178176class Scriptable (BaseObject): 
    179     """Allows objects to have predefined scripts executed on certain events""" 
    180     def __init__ (self, scripts = None, **kwargs): 
     177    """Allows objects to have predefined parpg executed on certain events""" 
     178    def __init__ (self, parpg = None, **kwargs): 
    181179        """Init operation for scriptable objects 
    182            @type scripts: Dictionary 
    183            @param scripts: Dictionary where the event strings are keys. The  
     180           @type parpg: Dictionary 
     181           @param parpg: Dictionary where the event strings are keys. The  
    184182           values are 3-item tuples (function, positional_args, keyword_args)""" 
    185183        BaseObject.__init__(self) 
    186184        self.attributes.append("scriptable") 
    187         self.scripts = scripts or {} 
     185        self.parpg = parpg or {} 
    188186         
    189187    def runScript (self, event): 
    190188        """Runs the script for the given event""" 
    191         if event in self.scripts and self.scripts[event]: 
    192             func, args, kwargs = self.scripts[event] 
     189        if event in self.parpg and self.parpg[event]: 
     190            func, args, kwargs = self.parpg[event] 
    193191            func (*args, **kwargs) 
    194192             
     
    197195        args = args or {} 
    198196        kwargs = kwargs or {} 
    199         self.scripts[event] = (func, args, kwargs) 
     197        self.parpg[event] = (func, args, kwargs) 
    200198 
    201199class Openable(DynamicObject, Scriptable): 
     
    323321            self.items[index] = item 
    324322 
    325         # Run any scripts associated with storing an item in the container 
     323        # Run any parpg associated with storing an item in the container 
    326324        try: 
    327325            if self.trueAttr ('scriptable'): 
     
    347345        del self.items[self.items.keys()[self.items.values().index(item)]] 
    348346 
    349         # Run any scripts associated with popping an item out of the container 
     347        # Run any parpg associated with popping an item out of the container 
    350348        try: 
    351349            if self.trueAttr ('scriptable'): 
     
    375373        del self.items[self.items.keys()[self.items.values().index(item)]] 
    376374 
    377         # Run any scripts associated with popping an item out of the container 
     375        # Run any parpg associated with popping an item out of the container 
    378376        try: 
    379377            if self.trueAttr ('scriptable'): 
  • trunk/game/parpg/objects/composed.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/objects/containers.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/objects/doors.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/objects/items.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/quest_engine.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
     
    1715 
    1816import yaml 
    19 from scripts.common.utils import locateFiles 
     17from parpg.common.utils import locateFiles 
    2018import os.path 
    2119 
  • trunk/game/parpg/sounds.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg/viewbase.py

    r791 r818  
    1 #!/usr/bin/env python 
    2  
    31#   This file is part of PARPG. 
    42 
  • trunk/game/parpg_editor.py

    r674 r818  
    3232 
    3333        args.append(os.path.join('..', parpg_dir, map_path)) 
    34         print args 
    3534 
    3635    fife_editor_path = os.path.join(parpg_path, '..', 'tools', 'map_editor') 
  • trunk/game/run.py

    r674 r818  
    1414#   along with this program.  If not, see <http://www.gnu.org/licenses/>. 
    1515 
    16 import os 
    17 import shutil 
    18 import imp 
     16#TODO: Modularize this script 
    1917import sys 
     18import logging 
    2019 
    21 #Check if config.py exists. Get 'fife_path' from config 
    22 try: 
    23         import config 
    24         sys.path.append(config.fife_path) 
    25 except: 
    26         pass 
     20from optparse import OptionParser 
     21from parpg.settings import Settings 
     22 
     23# Python 2.6 or lower 
     24parser = OptionParser(description='PARPG Launcher Script') 
     25parser.add_option('-p', '--paths', nargs=2, 
     26                  default='.', 
     27                  help='One or more paths to load settings from') 
     28parser.add_option('-f', '--logfile', 
     29                  help='Name of log file to save to') 
     30parser.add_option('-l', '--loglevel', default='critical', 
     31                  help='desired output level for log file') 
     32opts, args = parser.parse_args() 
     33 
     34# initialize settings 
     35settings = Settings(*opts.paths) 
     36 
     37levels = {'debug': logging.DEBUG, 
     38          'info': logging.INFO, 
     39          'warning': logging.WARNING, 
     40          'error': logging.ERROR, 
     41          'critical': logging.CRITICAL} 
     42 
     43#TODO: setup formating 
     44logging.basicConfig(filename=opts.logfile, level=levels[opts.loglevel]) 
     45logger = logging.getLogger('parpg') 
    2746 
    2847try: 
    29         from fife import fife 
    30         print "Using the FIFE python module found here: ", \ 
    31                 os.path.dirname(fife.__file__) 
     48    sys.path.insert(0, settings.parpg.FifePath) 
     49except AttributeError: 
     50    logger.warning('[parpg] section has no FifePath option') 
     51 
     52try: 
     53    from fife import fife 
     54    from parpg.application import PARPGApplication 
     55 
     56    from parpg.common import utils 
    3257except ImportError: 
    33         print "====================================================================== \n\ 
    34 FIFE was not found in path. \n\ 
    35 Try installing FIFE or creating config.py in the PARPG root directory, \n\ 
    36 with a variable pointing to the 'python' subdirectory \n\ 
    37 fife_path='<path_to_your_FIFE>' \n\ 
    38 Example: fife_path='../fife/engine/python/' \n\ 
    39 ======================================================================" 
     58    #TODO: pay attention to which module actually failed 
     59    logger.critical("Could not import fife module. Please install fife or add " 
     60                     "'FifePath' to the [parpg] section of your settings file") 
     61    sys.exit(1) 
    4062 
    41 from scripts.parpg import PARPGApplication 
    42 from scripts.common.utils import loadSettings 
     63# enable psyco if available and in settings file 
     64try: 
     65    import psyco 
     66    psyco_available = True 
     67except ImportError: 
     68    logger.warning('Psyco Acceleration unavailable') 
     69    psyco_available = False 
    4370 
    44 from scripts.common import utils 
     71if settings.fife.UsePsyco: 
     72    if psyco_available: 
     73        psyco.full() 
     74        logger.info('Psyco Acceleration enabled') 
     75    else: 
     76        logger.warning('Please install psyco before attempting to use it' 
     77                        'Psyco Acceleration disabled') 
     78else: 
     79    logger.info('Psycho Acceleration disabled') 
    4580 
    46 # add paths to the swig extensions 
    47 utils.addPaths ('../../engine/swigwrappers/python', '../../engine/extensions') 
    48 utils.addPaths ('./lib', './lib/extensions') 
    49  
    50  
    51 """This folder holds the main meta-data for PARPG. This file should be 
    52    minimal, since folding code into the controller with MVC is usually bad 
    53    All game and logic and data is held held and referenced in  
    54    /scripts/engine.py. All fife stuff goes in /scripts/world.py""" 
    55  
    56 def main_is_frozen(): 
    57     """returns True when running the exe,  
    58     and False when running from a script. """ 
    59     return (hasattr(sys, "frozen") or # new py2exe 
    60             hasattr(sys, "importers") # old py2exe 
    61             or imp.is_frozen("__main__")) # tools/freeze 
    62  
    63 def get_main_dir(): 
    64     """returns the directory name of the script  
    65     or the directory name of the exe""" 
    66     if main_is_frozen(): 
    67         return os.path.dirname(sys.executable) 
    68     return os.path.dirname(sys.argv[0]) 
    69  
    70  
    71 def main(): 
    72     """Application code starts from here""" 
    73     if not main_is_frozen(): 
    74         version = loadSettings().get("PARPG", "SettingsVersion") 
    75         dist_version = loadSettings("./settings-dist.xml").get("PARPG", "SettingsVersion") 
    76         if (version != dist_version): 
    77             print "Newer settings-dist.xml found, renaming settings.xml to settings-old.xml" 
    78             shutil.copyfile('./settings.xml', './settings-old.xml') 
    79             shutil.copyfile('./settings-dist.xml', './settings.xml') 
    80     app = PARPGApplication(loadSettings()) 
    81     app.run() 
    82  
    83 if __name__ == '__main__': 
    84     if loadSettings().get("FIFE", "UsePsyco"): 
    85         # Import Psyco if available 
    86         try: 
    87             import psyco 
    88             psyco.full() 
    89             print "Psyco acceleration in use" 
    90         except ImportError: 
    91             print "Psyco acceleration not used" 
    92     else: 
    93         print "Psyco acceleration not used" 
    94     main() 
    95  
     81# run the game 
     82app = PARPGApplication(settings) 
     83app.run() 
  • trunk/game/tests/test_carryable_container.py

    r653 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import GameObject, Carryable 
    20 from scripts.objects.composed import CarryableContainer 
     19from parpg.objects.base import GameObject, Carryable 
     20from parpg.objects.composed import CarryableContainer 
    2121 
    2222class  TestCarryableContainer(unittest.TestCase): 
  • trunk/game/tests/test_console.py

    r584 r818  
    1818 
    1919import unittest 
    20 from scripts.console import Console 
     20from parpg.console import Console 
    2121 
    2222class test_console(unittest.TestCase): 
  • trunk/game/tests/test_container.py

    r584 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import GameObject, Container, Scriptable, Carryable 
     19from parpg.objects.base import GameObject, Container, Scriptable, Carryable 
    2020 
    2121class  TestContainer(unittest.TestCase): 
     
    7979 
    8080    def testScripting(self): 
    81         container = self.ScriptableContainer(5,scripts={'onPlaceItem':(self.onPlaceItem,(),{}),'onTakeItem':(self.onTakeItem,(),{})}) 
     81        container = self.ScriptableContainer(5,parpg={'onPlaceItem':(self.onPlaceItem,(),{}),'onTakeItem':(self.onTakeItem,(),{})}) 
    8282        self.assertFalse(self.ranOnPlaceItem) 
    8383        self.assertFalse(self.ranOnTakeItem) 
  • trunk/game/tests/test_crate.py

    r584 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.containers import WoodenCrate 
     19from parpg.objects.containers import WoodenCrate 
    2020 
    2121class TestWoodenCrate(unittest.TestCase): 
     
    3535        self.assertEqual(self.crate.is_open, True) 
    3636        self.assertEqual(self.crate.locked, False) 
    37         self.assertEqual(self.crate.scripts, {}) 
     37        self.assertEqual(self.crate.parpg, {}) 
    3838 
    3939        self.assertEqual(self.crate2.ID, 'crate02') 
  • trunk/game/tests/test_dialogueprocessor.py

    r707 r818  
    2222    import unittest 
    2323 
    24 from scripts.common.utils import dedent_chomp 
    25 from scripts.dialogueprocessor import DialogueProcessor 
     24from parpg.common.utils import dedent_chomp 
     25from parpg.dialogueprocessor import DialogueProcessor 
    2626# NOTE Technomage 2010-12-08: Using the dialogue data structures might be a 
    2727#    violation of unit test isolation, but ultimately they are just simple 
    2828#    data structures that don't require much testing of their own so I feel 
    2929#    that it isn't a mistake to use them. 
    30 from scripts.dialogue import (Dialogue, DialogueSection, DialogueResponse, 
     30from parpg.dialogue import (Dialogue, DialogueSection, DialogueResponse, 
    3131    DialogueGreeting) 
    3232 
  • trunk/game/tests/test_game_object.py

    r584 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import GameObject 
     19from parpg.objects.base import GameObject 
    2020 
    2121class TestGameObject(unittest.TestCase): 
  • trunk/game/tests/test_inventory.py

    r653 r818  
    1717 
    1818import unittest 
    19 from scripts.inventory import Inventory 
    20 from scripts.objects.base import GameObject, Carryable 
     19from parpg.inventory import Inventory 
     20from parpg.objects.base import GameObject, Carryable 
    2121 
    2222class  TestInventory(unittest.TestCase): 
  • trunk/game/tests/test_living.py

    r611 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import Living 
     19from parpg.objects.base import Living 
    2020 
    2121class  TestLiving(unittest.TestCase): 
  • trunk/game/tests/test_lockable.py

    r584 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import Lockable, GameObject 
     19from parpg.objects.base import Lockable, GameObject 
    2020 
    2121 
  • trunk/game/tests/test_npc.py

    r653 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.actors import NonPlayerCharacter 
     19from parpg.objects.actors import NonPlayerCharacter 
    2020 
    2121class MockLayer(object): 
  • trunk/game/tests/test_objects_base.py

    r611 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import GameObject, Lockable, Container, Living, \ 
     19from parpg.objects.base import GameObject, Lockable, Container, Living, \ 
    2020                            Scriptable, CharStats, Wearable, Usable, Weapon, \ 
    2121                            Destructable, Trapable, Carryable 
  • trunk/game/tests/test_openable.py

    r584 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import Scriptable, Openable, GameObject 
     19from parpg.objects.base import Scriptable, Openable, GameObject 
    2020 
    2121 
     
    6666        """ Test Openable mixin with scripting""" 
    6767 
    68         self.openable = self.OpenableScriptable(3, scripts={'onOpen':(self.onOpen,(),{}),'onClose':(self.onClose,(),{})}) 
     68        self.openable = self.OpenableScriptable(3, parpg={'onOpen':(self.onOpen,(),{}),'onClose':(self.onClose,(),{})}) 
    6969        self.assertEqual(self.ran_on_close,False) 
    7070        self.assertEqual(self.ran_on_open,False) 
  • trunk/game/tests/test_scriptable.py

    r584 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import GameObject, Scriptable 
     19from parpg.objects.base import GameObject, Scriptable 
    2020 
    2121class  TestScriptable(unittest.TestCase): 
  • trunk/game/tests/test_single_item_container.py

    r653 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import GameObject, Carryable 
    20 from scripts.objects.composed import SingleItemContainer 
     19from parpg.objects.base import GameObject, Carryable 
     20from parpg.objects.composed import SingleItemContainer 
    2121 
    2222class  TestSingleItemContainer(unittest.TestCase): 
  • trunk/game/tests/test_wearable.py

    r653 r818  
    1717 
    1818import unittest 
    19 from scripts.objects.base import Wearable 
     19from parpg.objects.base import Wearable 
    2020 
    2121class  TestWearable(unittest.TestCase): 
  • trunk/game/utilities/convert_dialogue.py

    r668 r818  
    77import os.path 
    88import sys 
    9 sys.path.append(os.path.realpath(os.path.join(os.path.dirname(sys.argv[0]), 
    10                                  os.path.pardir))) 
     9sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), 
     10                                                 os.path.pardir))) 
    1111import shutil 
    1212import logging 
     13from optparse import OptionParser 
    1314 
    14 from scripts.common.optionparser import OptionParser 
    15 from scripts.dialogueparser import (OldYamlDialogueParser, YamlDialogueParser, 
    16     DialogueFormatError) 
     15from parpg.dialogueparsers import (OldYamlDialogueParser, YamlDialogueParser, 
     16                                   DialogueFormatError) 
    1717 
    1818def backup_file(filepath): 
     
    5252syntax. 
    5353 
    54     -h, --help             show this help message 
    55     -n, --no-backup        don't backup files before converting them 
    56     -v, --verbose          increase the verbosity of the script logger; may be 
    57                                specified multiple times to increase the logger 
    58                                output 
    59     -q, --quiet            decrease the verbosity of the script logger; may be 
    60                               specified multiple times to decrease the logger 
    61                               output 
    62  
    6354If the file_or_dir argument is a directory, then this script will attempt to 
    6455convert all .yaml files in the directory that contain valid dialogues. 
     
    7465    logging_level = logging.WARNING 
    7566     
    76     option_parser = OptionParser(usage=usage_message, args=argv[1:]) 
    77     for option in option_parser: 
    78         if (option == '-h' or option == '--help'): 
    79             print(option_parser.usage) 
    80             sys.exit(0) 
    81         elif (option == '-n' or option == '--no-backup'): 
    82             backup = False 
    83         elif (option == '-v' or option == '--verbose'): 
    84             logging_level -= 10 
    85         elif (option == '-q' or option == '--quiet'): 
    86             logging_level += 10 
    87         else: 
    88             # invalid option 
    89             message = '"{0}" is not a valid argument or option'.format(option) 
    90             option_parser.error(message) 
    91     logging.basicConfig(format='%(message)s', level=logging_level, 
    92                         stream=sys.stdout) 
     67    parser = OptionParser(usage=usage_message, 
     68                          description="Convert YAML dialogue files written " 
     69                                      "in Techdemo1 syntax to the new " 
     70                                      "Techdemo2 syntax.") 
     71    parser.add_option('-n', '--no-backup', default=True) 
     72    parser.add_option('-v', '--verbose', action='count', default=0) 
     73    parser.add_option('-q', '--quiet', action='count', default=0) 
     74    opts, args = parser.parse_args() 
     75 
    9376     
    94     path = option_parser.get_next_prog_arg() 
     77    verbosity = opts.verbose * 10 
     78    quietness = - (opts.quiet * 10) 
     79    logging_level += (verbosity + quietness) 
     80    logging.basicConfig(format='%(message)s', level=logging_level) 
     81 
     82    try: 
     83        path = args[0] 
     84    except IndexError: 
     85        parser.print_help() 
     86        sys.exit(1) 
     87         
    9588    if (os.path.isdir(path)): 
    9689        for filepath in os.listdir(path): 
  • trunk/game/utilities/dialogueChecker.py

    r653 r818  
    2020 
    2121import sys 
    22 sys.path = ['../scripts'] + sys.path 
     22sys.path = ['../parpg'] + sys.path 
    2323 
    2424 
  • trunk/tools/pychan_designer/fonts/freefont/COPYING

    r716 r818  
    134134  The "Corresponding Source" for a work in object code form means all 
    135135the source code needed to generate, install, and (for an executable 
    136 work) run the object code and to modify the work, including scripts to 
     136work) run the object code and to modify the work, including parpg to 
    137137control those activities.  However, it does not include the work's 
    138138System Libraries, or general-purpose tools or generally available free 
  • trunk/tools/pychan_designer/fonts/freefont/CREDITS

    r716 r818  
    6666 
    6767Between April 1990 and March 1992, Wadalab Kanji Comittee put together 
    68 a series of scalable font files with Japanese scripts, in four forms: 
     68a series of scalable font files with Japanese parpg, in four forms: 
    6969Sai Micho, Chu Mincho, Cho Kaku and Saimaru. The font files are 
    7070written in custom file format, while tools for conversion into 
     
    329329M/S Cyberscape Multimedia Limited, Mumbai, developers of Akruti 
    330330Software for Indian Languages (http://www.akruti.com/), have released 
    331 a set of TTF fonts for nine Indian scripts (Devanagari, Gujarati, 
     331a set of TTF fonts for nine Indian parpg (Devanagari, Gujarati, 
    332332Telugu, Tamil, Malayalam, Kannada, Bengali, Oriya, and Gurumukhi) 
    333333under the GNU General Public License (GPL). You can download the fonts 
     
    502502* George Douros 
    503503 
    504 The creator of several fonts focusing on ancient scripts and symbols. 
     504The creator of several fonts focusing on ancient parpg and symbols. 
    505505Many of the glyphs are created by making outlines from scanned images 
    506506of ancient sources. 
  • trunk/tools/pychan_designer/fonts/freefont/ChangeLog

    r716 r818  
    613613        * FreeSerifItalic.sfd: 
    614614 
    615         Changed lookup table scripts for Devanagari and Bengali. 
     615        Changed lookup table parpg for Devanagari and Bengali. 
    616616        Find Problems -> ATT found several problems showing lookups acting on 
    617617        glyphs that weren't listed in the script ranges, including dev2, bng2 
     
    619619         
    620620        danda and doubledanda of Devanagari I understand are to be shared among 
    621         Indic scripts.  So included bng2 and dev2 in the 'aalt' table for those. 
     621        Indic parpg.  So included bng2 and dev2 in the 'aalt' table for those. 
    622622         
    623623        The 'init' and 'half' tables for Bengali made active for bng2. 
     
    838838        * FreeSerifBold.sfd, FreeSerifBoldItalic.sfd, FreeSerifItalic.sfd: 
    839839 
    840         Added some Superscripts and Subscripts 
     840        Added some Superparpg and Subparpg 
    841841 
    842842        * FreeMono.sfd, FreeMonoBold.sfd, FreeMonoBoldOblique.sfd, FreeMonoOblique.sfd: 
    843843 
    844         Finished off Superscripts and subscripts 
     844        Finished off Superparpg and subparpg 
    845845 
    846846        Completed General Punctuation for Mono faces 
     
    14321432        Unicode ranges) into the Private Use area. 
    14331433         
    1434         In Serif, I segregated the scripts, in Sans it was hard to see where one 
     1434        In Serif, I segregated the parpg, in Sans it was hard to see where one 
    14351435        began and another ended, so I moved them en masse. 
    14361436         
     
    14411441        * FreeSansBold.sfd, FreeSansOblique.sfd: 
    14421442 
    1443         Fixed (I hope the last) problem with scripts in lookups 
     1443        Fixed (I hope the last) problem with parpg in lookups 
    14441444        Find Problems -> ATT (all selected) finds multiple issues, 
    14451445         
    14461446        * FreeSansBold.sfd: 
    1447         In addition to script 'guru', added 'gur2' to the scripts for these 
     1447        In addition to script 'guru', added 'gur2' to the parpg for these 
    14481448        lookups 
    14491449                'nukt' Nukta forms in Gurmukhi 
     
    14551455         
    14561456        * FreeSansOblique.sfd: 
    1457         In addition to script 'beng', added 'bng2' to the scripts for the lookup 
     1457        In addition to script 'beng', added 'bng2' to the parpg for the lookup 
    14581458                'half' Half Forms in Bengali 
    14591459         
     
    14611461                'aalt' Access All Alternates in Latin 
    14621462        contains only Bengali letters. 
    1463         Re-named as Bengali, made to work on beng, bng2 scripts 
     1463        Re-named as Bengali, made to work on beng, bng2 parpg 
    14641464 
    146514652008-06-20 Steve White 
     
    18781878 
    18791879        Deleted ranges for Oriya, Kannada, on account of 
    1880         1) they only contained a subset of the consonant glyphs of the scripts, 
     1880        1) they only contained a subset of the consonant glyphs of the parpg, 
    18811881           few if any vowels, and had no ligature lookups as required 
    18821882        2) Kannada was based on the Akurti fonts, which have copyright issues. 
     
    19821982        * FreeMono.sfd, FreeSans.sfd, FreeSerif.sfd: 
    19831983 
    1984         More work on Superscripts and Subscripts, Spacing Modifiers. 
     1984        More work on Superparpg and Subparpg, Spacing Modifiers. 
    19851985        Sans is now complete in both. 
    19861986        Added Pfennig to Sans and Mono. 
     
    26582658        A previous commit had added lookups that referred to these, 
    26592659 
    2660         More fiddling with super/subscripts 
     2660        More fiddling with super/subparpg 
    26612661 
    26622662        * Makefile, Makefile, GenerateTrueType: 
     
    27742774        # A couple of Indic lookups had incorrect script DFLT; one had 'latn'. 
    27752775 
    2776         # Don't understand why there are scripts named 
     2776        # Don't understand why there are parpg named 
    27772777                dev2 bng2 grj2 gur2 when there are already deva beng gurj guru 
    27782778          But anyway, lots of 'vatu' 'pres' 'haln' and 'liga' lookups contained 
    2779           characters in the '2' scripts but were lablled only for the 'non-2'  
    2780           ones.  Added the '2' scripts to all these lookups. Suspect a mistake. 
     2779          characters in the '2' parpg but were lablled only for the 'non-2'  
     2780          ones.  Added the '2' parpg to all these lookups. Suspect a mistake. 
    27812781 
    27822782        Note: several of these problems are repeated in other Sans faces. 
     
    29932993        * sfd/*.sfd: started removing glyphs with back layers (printing bug) 
    29942994        * sfd/*.sfd: adjusted vulgar fractions (bug #17756) 
    2995         * sfd/*.sfd: adjusted numerical superscripts (bug #20278) 
     2995        * sfd/*.sfd: adjusted numerical superparpg (bug #20278) 
    29962996 
    299729972008-02-18  Steve White 
     
    36873687        (U+2070-2079). 
    36883688 
    3689         * sfd/FreeSansBold.sfd - added subscripts and superscripts 
     3689        * sfd/FreeSansBold.sfd - added subparpg and superparpg 
    36903690        (U+2070-208F), completed fractions (U+2152-215F) and Roman 
    36913691        numerals (U+2160-217F). 
     
    39173917 
    39183918        * sfd/FreeSerifBold.sfd, sfd/FreeSerifItalic.sfd - Started working 
    3919         on super- and subscripts.  
     3919        on super- and subparpg.  
    39203920 
    392139212003-09-12  Primoz Peterlin  <primoz.peterlin@biofiz.mf.uni-lj.si> 
     
    39263926        * sfd/FreeSansBold.sfd - Cleared background characters in Latin 
    39273927        Extended-A. Added some automatically constructed characters in 
    3928         Latin Extended-B. Started with superscripts and subscripts. 
     3928        Latin Extended-B. Started with superparpg and subparpg. 
    39293929 
    39303930        * sfd/FreeSans.sfd - Subscript numerals (U+2080-U+2089) completed. 
     
    39653965 
    39663966        * sfd/FreeSerif.sfd - Clean-up of the Cyrillic letters added on 
    3967         March 27; super- and subscripts, vulgar fractions. 
     3967        March 27; super- and subparpg, vulgar fractions. 
    39683968 
    396939692003-05-09  Primoz Peterlin  <primoz.peterlin@biofiz.mf.uni-lj.si> 
     
    42914291        Miscellaneous Symbols area. 
    42924292 
    4293         * sfd/FreeMonoBoldOblique.sfd - Added subscripts, superscripts and 
     4293        * sfd/FreeMonoBoldOblique.sfd - Added subparpg, superparpg and 
    42944294        vulgar fractions. 
    42954295 
     
    42974297        Latin and Cyrillic. 
    42984298 
    4299         * sfd/FreeMonoBold.sfd - Added subscripts, superscripts and vulgar 
     4299        * sfd/FreeMonoBold.sfd - Added subparpg, superparpg and vulgar 
    43004300        fractions. 
    43014301 
    430243022002-04-15  Primoz Peterlin  <primoz.peterlin@biofiz.mf.uni-lj.si> 
    43034303 
    4304         * www/design-notes.html - Updated notes on super-/subscripts in 
     4304        * www/design-notes.html - Updated notes on super-/subparpg in 
    43054305        Free Mono Bold. Separate subsections for Free Mono regular and 
    43064306        Free Mono Bold. 
  • trunk/tools/pychan_designer/fonts/freefont/README

    r716 r818  
    4444Which font shapes should be made?  Historical style terms like Renaissance 
    4545or Baroque letterforms cannot be applied beyond Latin/Cyrillic/Greek 
    46 scripts to any greater extent than Kufi or Nashki can be applied beyond 
     46parpg to any greater extent than Kufi or Nashki can be applied beyond 
    4747Arabic script; "italic" is really only meaningful for Latin letters.  
    4848 
  • trunk/tools/pychan_designer/pychan_designer.py

    r716 r818  
     1#! /usr/bin/env python2 
     2 
    13from __future__ import print_function 
    24import sys 
     
    1214from fife.extensions import pychan 
    1315 
    14 from scripts.common.optionparser import OptionParser, OptionError 
    15 from scripts.common.utils import dedent_chomp 
    16 from scripts import gui 
     16from parpg.common.optionparser import OptionParser, OptionError 
     17from parpg.common.utils import dedent_chomp 
     18from parpg import gui 
    1719 
    1820USAGE_MESSAGE = '''\ 
     
    7274        setting = Setting(settings_file=settings_file) 
    7375        super(GuichanDesignerApplication, self).__init__(setting=setting) 
     76        # PyChanDesigner fonts 
    7477        pychan.loadFonts('fonts/freefont.fontdef') 
    7578        pychan.setupModalExecution(self.mainLoop, self.breakFromMainLoop) 
     
    348351    parpg_root = os.path.abspath(os.path.join('..', '..', 'game')) 
    349352    os.chdir(parpg_root) 
     353    # Load PARPG fonts 
     354    fonts_directory = os.path.abspath('fonts') 
     355    file_names = os.listdir(fonts_directory) 
     356    for file_name in file_names: 
     357        base_name, extension = os.path.splitext(file_name) 
     358        if extension == '.fontdef': 
     359            file_path = os.path.join(fonts_directory, file_name) 
     360            pychan.loadFonts(file_path) 
    350361    application.xml_script_path = xml_script_path 
    351362    with file(xml_script_path) as xml_file: 
  • trunk/tools/pychan_designer/settings-dist.xml

    r716 r818  
    22<Settings> 
    33    <Module name="FIFE"> 
    4         <Setting name="FullScreen" type="bool">True</Setting> 
     4        <Setting name="FullScreen" type="bool">False</Setting> 
    55        <Setting name="PlaySounds" type="bool">False</Setting> 
    66        <Setting name="RenderBackend" type="str">OpenGL</Setting> 
  • trunk/tools/writing_editor/data/recent_files.txt

    r217 r818  
    1 /home/brett/fife/clients/writingEditor/scripts/writingEditor.py 
     1/home/brett/fife/clients/writingEditor/parpg/writingEditor.py 
  • trunk/tools/writing_editor/run.py

    r584 r818  
    1919 
    2020from PyQt4 import QtCore, QtGui 
    21 from scripts.writingEditor import WritingEditor 
     21from parpg.writingEditor import WritingEditor 
    2222 
    2323def createApplication(): 
  • trunk/tools/writing_editor/scripts/dialogMap.py

    r584 r818  
    1717 
    1818from PyQt4 import QtGui, QtCore 
    19 from scripts.parser import parse 
     19from parpg.parser import parse 
    2020 
    2121class DialogScene(object): 
  • trunk/tools/writing_editor/scripts/writingEditor.py

    r584 r818  
    2121from ui.editor_ui import Ui_writingEditor 
    2222from ui.popupWindows import * 
    23 from scripts.syntaxHighlight import SyntaxHighlighter 
    24 from scripts.settings import Settings 
    25 from scripts.dialogMap import DialogMap 
    26 from scripts.parser import parse 
     23from parpg.syntaxHighlight import SyntaxHighlighter 
     24from parpg.settings import Settings 
     25from parpg.dialogMap import DialogMap 
     26from parpg.parser import parse 
    2727 
    2828 
  • trunk/tools/writing_editor/ui/popupWindows.py

    r584 r818  
    1717 
    1818from PyQt4 import QtGui, QtCore 
    19 from scripts.syntaxHighlight import SyntaxHighlighter 
     19from parpg.syntaxHighlight import SyntaxHighlighter 
    2020 
    2121class AboutWindow(QtGui.QMainWindow): 
     
    9898        @type parent: QtGui.QWidget? 
    9999        @param parent: the parent widget 
    100         @type settings: scripts.settings.Settings 
     100        @type settings: parpg.settings.Settings 
    101101        @param settings: the settings for the application 
    102102        """ 
Note: See TracChangeset for help on using the changeset viewer.