Permalink
Browse files

restructured project

  • Loading branch information...
1 parent 5c5d02e commit b3d05691c0f1df9fb32254ad964303fffb34718d @lavelle committed Feb 9, 2013
View
@@ -12,3 +12,4 @@ clipcloud/*
*.egg-info
dist
+build
File renamed without changes.
View
@@ -0,0 +1,2 @@
+API_KEY = "rvml2qyo081dvmn"
+API_SECRET = "toe9kimrkhd4bx7"
File renamed without changes.
@@ -5,8 +5,8 @@
import os
from argparse import ArgumentParser
-from lib.main import *
-from lib.settings import *
+from main import *
+from settings import *
def clipcloud():
@@ -88,15 +88,13 @@ def clipcloud():
def main():
- # Don't do anything if this file is being imported as a module
- if __name__ == '__main__':
# If program execution time is being measured, call the main function from a timer
- if TIMER_ACTIVATED:
- from timeit import Timer
- t = Timer('clipcloud.clipcloud()', 'import clipcloud')
- print t.timeit(number=1)
+ # if TIMER_ACTIVATED:
+ # from timeit import Timer
+ # t = Timer('clipcloud.clipcloud()', 'import clipcloud')
+ # print t.timeit(number=1)
# Otherwise just call it
- else:
- clipcloud()
-
-main()
+ # else:
+ clipcloud()
+if __name__ == '__main__':
+ main()
@@ -4,9 +4,9 @@
from dropbox.session import DropboxSession
from dropbox.client import DropboxClient
-from lib.settings import *
-from lib.apikeys import *
-from lib.message import Message
+from settings import *
+from apikeys import *
+from message import Message
class Dropbox:
@@ -21,27 +21,37 @@ def format_grid(grid, divider_positions=[], truncatable_column=None):
try:
import subprocess
terminal_width = int(subprocess.check_output('stty size').split()[1])
+
except:
print 'The size of your terminal window could not be determined so ' \
'the layout of the grid below may be broken due to text wrapping.'
- terminal_width = 80 # default width for a lot of systems
+
+ # default width for a lot of systems
+ terminal_width = 80
# if the grid is wider than the terminal window work out the difference between them
# this is the amount to truncate the grid by
terminal_diff = None
+
if total > terminal_width:
if truncatable_column is not None:
- terminal_diff = terminal_width - total - 12 # 12 is the number of dividers and spaces added
- widths[2] += terminal_diff # reduce the width of the column by the difference
+ # 12 is the number of dividers and spaces added
+ terminal_diff = terminal_width - total - 12
+ # reduce the width of the column by the difference
+ widths[2] += terminal_diff
+
else:
print 'The grid is wider than your terminal but no columns can be truncated so ' \
'some columns may not be visible.'
- a = [] # final grid array
+ # final grid array
+ a = []
+
for row in grid:
# truncate column 3 if the table would be wider than the terminal window
# id, url and date don't vary much in width, only the local path is worth truncating
- if truncatable_column is not None and terminal_diff is not None and len(row[truncatable_column]) > widths[truncatable_column]:
+ if truncatable_column is not None and terminal_diff is not None and \
+ len(row[truncatable_column]) > widths[truncatable_column]:
row[truncatable_column] = row[truncatable_column][:terminal_diff - 3] + '...'
# format the cells into a string with dividers between and add the row to the final grid
@@ -51,7 +61,9 @@ def format_grid(grid, divider_positions=[], truncatable_column=None):
# add a horizontal divider only below the header
width = len(s)
+
for pos, i in zip(divider_positions, xrange(len(divider_positions))):
a.insert(pos + i, '-' * width)
- return '\n' + '\n'.join(a)[:-1] # convert to the final string and trim the last line break
+ # convert to the final string and trim the last line break
+ return '\n' + '\n'.join(a)[:-1]
View
@@ -1,5 +1,5 @@
-from lib.tray import SysTrayIcon
-from lib.history import History
+from tray import SysTrayIcon
+from history import History
hover_text = "ClipCloud"
icon_filename = 'favicon.ico'
@@ -1,4 +1,4 @@
-from lib.settings import HISTORY_PATH
+from settings import HISTORY_PATH
from time import time
from datetime import date
from pyjson import PyJson
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -46,4 +46,3 @@
When you upload a file, a link to it will be placed in your clipboard, or you can share it to a social network or send it by email.'''
DEBUG = True
-TIMER_ACTIVATED = False
View
@@ -17,7 +17,20 @@
install_requires=[
'dropbox'
],
- py_modules=['src/clipcloud'],
+ py_modules=[
+ 'apikeys',
+ 'clipcloud',
+ 'clipboard',
+ 'dbox',
+ 'gridformat',
+ 'history',
+ 'main',
+ 'message',
+ 'pyjson',
+ 'screenshot',
+ 'settings',
+ 'tray'
+ ],
entry_points={
'console_scripts': ['clipcloud=clipcloud:main']
}
View
Binary file not shown.
@@ -1 +0,0 @@
-import client, rest, session
Oops, something went wrong.

0 comments on commit b3d0569

Please sign in to comment.