Skip to content

Commit

Permalink
Fixed support for random word
Browse files Browse the repository at this point in the history
  • Loading branch information
kimpettersen committed Nov 24, 2013
1 parent 1fd2da7 commit d3aedf0
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions random.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import sublime, sublime_plugin, random, string
import sublime, sublime_plugin, random, string, os

# with open('words') as f:
# words = f.read().splitlines()

word_file = '%s/words.txt' % os.path.dirname(os.path.realpath(__file__))


with open(word_file) as f:
words = f.read().splitlines()

'''
Base class for the Random generator. Extends the WindowCommand and adds helper methods
Expand Down Expand Up @@ -104,16 +108,14 @@ def generate_letters_and_numbers(self):
def run(self, view, **kwargs):
self.insert(view, self.generate_letters_and_numbers)

# class RandomWordCommand(RandomText):
class RandomWordCommand(RandomText):

# def generate_word(self):
# return random.choice(words)


# def run(self, view, **kwargs):
# self.insert(view, self.generate_word)
def generate_word(self):
return random.choice(words)


def run(self, view, **kwargs):
self.insert(view, self.generate_word)

'''
END Text commands
Expand Down

0 comments on commit d3aedf0

Please sign in to comment.