Skip to content

Commit

Permalink
Improved defaults, added per-user default option system
Browse files Browse the repository at this point in the history
When looking for an option, it looks down a stack of properties files,
looking first at the project.config file given on the command line,
then defaults/user.config if it exists, then defaults/code_swarm.config

defaults/code_swarm.config is now the single point of truth for default
values, rather than spreading them around the source code
  • Loading branch information
rictic committed Oct 24, 2008
1 parent 4b3be06 commit a94b5a9
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 427 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dist
frames
*.pyc
*.proof
image_cache
image_cache
defaults/user.config
75 changes: 2 additions & 73 deletions bin/config.template
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
# This is a sample configuration file for code_swarm

# Frame width
Width=1024

# Frame height
Height=640

# Input file
InputFile=log.xml

# Particle sprite file
ParticleSpriteFile=src/particle.png

# Optional Method instead of MillisecondsPerFrame
FramesPerDay=6

# Background in R,G,B
Background=0,0,0

# Color assignment rules
# Keep in order, do not skip numbers. Numbers start
# at 1.
Expand All @@ -38,69 +23,13 @@ TakeSnapshots=false
# Where to save each frame
SnapshotLocation=code_swarm_frames/#####.png

# Draw names (combinatory) :
# Draw sharp names?
DrawNamesSharp=true
# And draw a glow around names? (Runs slower)
DrawNamesHalos=false

# Draw files (combinatory) :
# Draw sharp files
DrawFilesSharp=true
# Draw fuzzy files
DrawFilesFuzzy=true
# Draw jelly files
DrawFilesJelly=false

# Show the Legend at start
ShowLegend=true

# Show the History at start
ShowHistory=true

# Show the Date at start
ShowDate=true

# Show edges between authors and files, mostly for debug purpose
ShowEdges=false

# Turn on Debug counts.
ShowDebug=false

# Natural distance of files to people
EdgeLength=25

# Life of an Edge
EdgeLife=150

# Life of a File
FileLife=150

# Life of a Person
PersonLife=255


# Highlight percent.
# This is the amount of time that the person or
# file will be highlighted.
HighlightPct=5

## Physics engine selection and configuration
# Directory physics engine config files reside in.
PhysicsEngineConfigDir=physics_engine

## Physical engine selection and configuration
# Force calculation algorithms (PhysicsEngineLegacy, PhysicsEngineSimple...) :
PhysicsEngineSelection=PhysicsEngineOrderly

#Is the input xml sorted by date? It's faster and uses much less memory if it is
IsInputSorted=true
# - All of the given scripts for producing repository xml files produce sorted data
# - Please file a bug if one doesn't


# OpenGL is experimental. Use at your own risk.
UseOpenGL=true

# Leave blank to go without avatars
AvatarFetcher=GravatarFetcher
# Uncomment to not use avatars
#AvatarFetcher=NoAvatar
81 changes: 2 additions & 79 deletions bin/freebase_config.template
Original file line number Diff line number Diff line change
@@ -1,92 +1,15 @@
# This is a sample configuration file for code_swarm

# Frame width
Width=1024

# Frame height
Height=640


# Particle sprite file
ParticleSpriteFile=src/particle.png

# Optional Method instead of MillisecondsPerFrame
FramesPerDay=6

# Background in R,G,B
Background=0,0,0


# Save each frame to an image?
TakeSnapshots=false

# Where to save each frame
SnapshotLocation=code_swarm_frames/#####.png

# Draw names (combinatory) :
# Draw sharp names?
DrawNamesSharp=true
# And draw a glow around names? (Runs slower)
DrawNamesHalos=false

# Draw files (combinatory) :
# Draw sharp files
DrawFilesSharp=true
# Draw fuzzy files
DrawFilesFuzzy=true
# Draw jelly files
DrawFilesJelly=false

# Show the Legend at start
ShowLegend=false

# Show the History at start
ShowHistory=true

# Show the Date at start
ShowDate=true

# Show edges between authors and files, mostly for debug purpose
ShowEdges=false

# Turn on Debug counts.
ShowDebug=false

# Natural distance of files to people
EdgeLength=25

# Life of an Edge
EdgeLife=150

# Life of a File
FileLife=150

# Life of a Person
PersonLife=255


# Highlight percent.
# This is the amount of time that the person or
# file will be highlighted.
HighlightPct=5

## Physics engine selection and configuration
# Directory physics engine config files reside in.
PhysicsEngineConfigDir=physics_engine

## Physical engine selection and configuration
# Force calculation algorithms (PhysicsEngineLegacy, PhysicsEngineSimple...) :
PhysicsEngineSelection=PhysicsEngineOrderly

#Is the input xml sorted by date? It's faster and uses much less memory if it is
#Our freebase output should always be sorted by date
IsInputSorted=true
# - All of the given scripts for producing repository xml files produce sorted data
# - Please file a bug if one doesn't


# OpenGL is experimental. Use at your own risk.
UseOpenGL=true

# Leave blank to go without avatars
# Set to NoAvatar to not use user images
AvatarFetcher=FreebaseAvatarFetcher
AvatarSize=40
106 changes: 106 additions & 0 deletions defaults/code_swarm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# The global config file for code_swarm, defining the defaults.

# Don't edit this file for personal preferences, copy user.config.sample
# to defaults/user.config and edit that

# Frame width
Width=800

# Frame height
Height=600


# Optional Method instead of MillisecondsPerFrame
FramesPerDay=6

# Background in R,G,B
Background=0,0,0

# Maximum number of background threads, used mostly for writing out snapshots
# When taking snapshots this setting has a significant effect on memory use
MaxThreads=8

# Save each frame to an image?
TakeSnapshots=false

# Where to save the frames
SnapshotLocation=code_swarm_frames/#####.png

## How to draw names (choose as many as you like)
# Draw sharp names?
DrawNamesSharp=true
# And draw a glow around names? (kinda slow)
DrawNamesHalos=false

## How to draw files (choose as many as you like)
# Draw sharp files?
DrawFilesSharp=true
# Draw fuzzy files?
DrawFilesFuzzy=true
# Draw jelly files?
DrawFilesJelly=false

# Show a legend of colors and their labels
ShowLegend=true

# Show a histogram of edits over time
ShowHistory=true

# Show the date
ShowDate=true

# Show edges between authors and files, mostly for debug purpose
ShowEdges=false

# Turn on debug info
ShowDebug=false


Font=SansSerif
FontSize=10
BoldFontSize=14

# Natural distance of files to people
EdgeLength=25

# Initial life values
EdgeLife=150
FileLife=150
PersonLife=255

# How much life is lost per frame
EdgeDecrement=-2
FileDecrement=-2
PersonDecrement=-1

# Initial mass
FileMass=1.0
PersonMass=100.0

# Controls how long a node a person or file is highlighted after
# they're involved in an edit.
HighlightPct=5

## Physics engine selection and configuration
# Directory physics engine config files reside in.
PhysicsEngineConfigDir=physics_engine

## Physical engine selection and configuration
# Force calculation algorithms (PhysicsEngineLegacy, PhysicsEngineSimple...) :
PhysicsEngineSelection=PhysicsEngineOrderly

#Don't assume the input is sorted
IsInputSorted=false

# Particle sprite file
ParticleSpriteFile=src/particle.png

# OpenGL has problems on some platforms. We're closer to having it work
# automatically out of the box, but not close enough to enable it by default
UseOpenGL=false

# Default user avatar
AvatarFetcher=GravatarFetcher

#Size in pixels of the width and height of avatar images
AvatarSize=40
18 changes: 18 additions & 0 deletions defaults/user.config.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Your personal preferences for code_swarm, applied to every visualization
# you run, unless overridden by the individual visualization's config

#DON'T EDIT THIS FILE IN PLACE, FIRST COPY IT TO defaults/user.config
#CHANGES TO THIS FILE WON'T BE SEEN BY code_swarm, ONLY user.config

#Some common options to customize:

# It's much faster if we can use OpenGL, but it still doesn't work on some
# platforms/configurations
UseOpenGL=true

# The size of the visualization window
Width=1024
Height=640


#For more options, see defaults/code_swarm.config
2 changes: 1 addition & 1 deletion src/AvatarFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class AvatarFetcher {
public int size;
public AvatarFetcher(CodeSwarmConfig cfg) {
this.cfg = cfg;
size = cfg.getPositiveIntProperty("AvatarSize", 40);
size = cfg.getPositiveIntProperty("AvatarSize");
}

public String fetchUserImage(String username) {
Expand Down
Loading

0 comments on commit a94b5a9

Please sign in to comment.