python์ผ๋ก windows์ฉ dropbox ์ฐ๋ ์ฑ ๋ง๋ค๊ธฐ
http://codejob.co.kr/docs/view/2/
python์ 2.7๋ฒ์ ์ ์ค์นํ๋ค.
์์ค๋ฅผ utf-8๋ก ์ฒ๋ฆฌ. ์ ์ผ ์์ค์ ๋ฃ์ด์ค๋ค.
strptime, strftime ํจ์ ์ฌ์ฉ์์๋ locale ์ค์ ์ ์์ด๋ก ๋ฐ๊ฟ์ค๋ค.
loc= locale.setlocale(locale.LC_TIME,('English_United States','1252')) mtime_st = time.strptime(file_meta['client_mtime'], '%a, %d %b %Y %H:%M:%S +0000') cl_mtime = time.strftime(u"%Y%m%d%H%M%S", mtime_st)
http://zetcode.com/wxpython
wxpython์ stable release๊ฐ 2.8์ด์ง๋ง, webview ์ฌ์ฉ์ ์ํด development release์ธ 2.9 ๋ฒ์ ์ ์ค์นํ๋ค.
webview๊ฐ ํ์์์ผ๋ฉด, 2.8 ๋ฒ์ ๋ ์๊ด์๋ค.
demo ๋ ์ค์นํด์, ์ฐธ๊ณ ํ๋ค.
ํ๋ฉด ์ฐํ๋จ์ ๋ณด์ด๊ธฐ
corner = wx.GetClientDisplayRect().GetBottomRight() + wx.Point(1,1) self.SetPosition(corner-wx.Point(*self.GetSize()))
ํ๋ฉด ์ ์ค์์ ๋ณด์ด๊ธฐ
wv = wx.html2.WebView.New(panel) wv.LoadURL(url)
clipboard ๊ฐ์ ธ์ค๊ธฐ/๋ฃ๊ธฐ
do = wx.TextDataObject() if wx.TheClipboard.Open(): success = wx.TheClipboard.GetData(do) wx.TheClipboard.Close() if success: data = do.GetText() else: data = "error" do = wx.TextDataObject() do.SetText(text) if wx.TheClipboard.Open(): wx.TheClipboard.SetData(do) wx.TheClipboard.Close()
imageํ์ผ์ ์์ค ๋ด๋ถ์ ํฌํจ. ์๋ ๋ด์ฉ์ py ํ์ผ์ ๋ง๋ค๊ณ ์คํ.
import sys from wx.tools import img2py arg = '-i IMAGE.png IMAGE.py' img2py.main(arg.split())
tray icon ์ค์ ์ wx.TaskBarIcon ์ ์ฌ์ฉํ๋ค.
panel์ ๋จ์ ์์ญ์ ๊ฝ์ฑ์ฐ๊ณ ์ถ์ ๋,
vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(view, propotion=1, flag=wx.ALL|wx.EXPAND)
https://www.dropbox.com/developers
์ฐ์ tutorial ์ ๋ฐ๋ผํด๋ณด๊ณ , document ๋ฅผ ์ด์ฌํ ๋ณธ๋ค.
oauth ์ธ์ฆ์ ํ๋ฉด, access key ์ access secret ์ ์ป์ ์ ์๋๋ฐ, ์ ์ฅํด๋๋ฉด ์ฌ์ฌ์ฉ ๊ฐ๋ฅํ๋ค. aes๋ก ์ํธํํด์ sqlite3 ์ ์ ์ฅํ๋ ๋ฐฉ์์ผ๋ก ์ฒ๋ฆฌํ๋ค.
ํ์ผ์ด๋ฆ์ utf-8๋ก ์ธ์ฝ๋ฉ ์ฒ๋ฆฌ. txtํ์ผ ๋ด์ฉ์ ์ฝ์ด ์ฌ ๋๋, utf-8๋ก ๋์ฝ๋ฉ ์ฒ๋ฆฌ.
filedata = client.get_file(filename.encode("utf-8")).read().decode("utf-8")
py2exe๋ก ๋ฌถ๊ณ ๋์ ์คํํ ๋, ์ธ์ฆ ์๋ฌ๊ฐ ๋ ๋ ์๋ url ์ฐธ๊ณ > http://mfctips.com/2013/05/03/dropbox-python-sdk-with-py2exe-causes-notimplementederror-resource_filename-only-supported-for-egg-not-zip/
https://pypi.python.org/pypi/M2Crypto
์ด๊ฒ ์ค์น๊ฐ ์ข ๊น๋ค๋ก์ ๋ค. github ์์ windows ์ฉ install ๊ฐ๋ฅํ ๊ฑธ ๋ฐ์์ ์ค์นํ๋๋ฐ.. ์ง๊ธ ๋งํฌ๋ฅผ ๋ชป์ฐพ๊ฒ ๋ค;
aes ์/๋ณตํธํ๊ฐ ํ์ํ ๋ ์ฌ์ฉ
from M2Crypto import EVP from base64 import b64encode, b64decode import random #์ํธํ aes_key = "test" aes_iv = u'\u0000' * 16 cipher = EVP.Cipher(alg="aes_256_cbc", key = aes_key, iv = aes_iv, op = 1) encryptedContents = cipher.update("test") encryptedContents += cipher.final() e = b64encode(encryptedContents) #๋ณตํธํ d = b64decode(e) cipher = EVP.Cipher(alg="aes_256_cbc", key = aes_key, iv = aes_iv, op = 0) decryptedContents = cipher.update(d) decryptedContents += cipher.final() #random string r = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(32))
http://starship.python.net/crew/mhammond/win32/Downloads.html
์๋์ฐ ๊ธ๋ก๋ฒ ๋จ์ถํค๋ฅผ ์ํด ์ฌ์ฉ
#Win-V ๋จ์ถํค ๋ฑ๋ก. 86์ V์ ascii๊ฐ self.hotKeyId = wx.NewId() self.RegisterHotKey(self.hotKeyId, win32con.MOD_WIN, 86) self.Bind(wx.EVT_HOTKEY, self.tbicon.OnTaskBarPaste, id=self.hotKeyId)
http://www.py2exe.org/index.cgi/ListOfOptions
from distutils.core import setup import py2exe excludes = [ "pywin", "pywin.debugger", "pywin.debugger.dbgcon", "pywin.dialogs", "pywin.dialogs.list", "win32com.server", ] setup(windows=[{"script" : "test.py", "icon_resources" : [(1, "test.ico")]}], data_files = [('', ['trusted-certs.crt',])], options={ "py2exe":{ "packages" : ["encodings" , "wx", "dropbox"], "bundle_files": 1, "optimize" : 2, "compressed" : True, "excludes" : excludes, "dll_excludes": ["w9xpopen.exe"] } }, zipfile = None, )
cmd๋ฅผ ์ด๊ณ , ์๋ ๋ช
๋ น์ด ์คํ