Skip to content

Commit

Permalink
add new features
Browse files Browse the repository at this point in the history
  • Loading branch information
answer-huang committed Jul 29, 2014
1 parent e50cfe5 commit 7142039
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ build/
dist/
test*.py
*.pyc
*.psd
16 changes: 15 additions & 1 deletion AHDropTarget.py
Expand Up @@ -15,8 +15,22 @@ def OnDropFiles(self, x, y, filenames):
for filename in filenames:
print os.path.basename(filename)
#TODO: 增加对dSYM文件的支持
if filename.endswith('xcarchive'):
if filename.endswith(('xcarchive', 'dSYM')):
self.fileList.append(filename)

self.window.filesList = self.fileList
self.window.ShowFileType()

#def OnEnter(self, x, y, z):
# print x, y, z
# print 'OnEnter x:%d, y:%d' % (x, y)
#
#def OnLeave(self):
# print 'leave windows'
#
#def OnDrop(self, x, y):
# print 'OnDrop x:%d, y:%d' % (x, y)
# print x, y
#
#def OnData(self, x, y, z):
# print 'OnData x:%d, y:%d' % (x, y)
48 changes: 48 additions & 0 deletions RunScript.py
@@ -0,0 +1,48 @@
#coding=utf-8

"""
* User: answer.huang
* Email: aihoo91@gmail.com
* Date: 14-7-28
* Time: 23:36
* Blog: answerhuang.duapp.com
"""


import os
import sys
import time
import shutil
import sqlite3

print os.environ["EFFECTIVE_PLATFORM_NAME"]
print os.environ["DWARF_DSYM_FOLDER_PATH"]

if os.environ["BUILD_STYLE"] == "Debug":
print "跳过debug模式"
sys.exit()

if os.environ["EFFECTIVE_PLATFORM_NAME"] == "-iphonesimulator":
print "跳过模拟器编译情况"
sys.exit()

dsym_folder_path = os.environ["DWARF_DSYM_FOLDER_PATH"]
dsym_file_name = os.environ["DWARF_DSYM_FILE_NAME"]
src_path = os.path.join(dsym_folder_path, dsym_file_name)



executable_name = os.environ["EXECUTABLE_NAME"]
relative_dest_path = "dSYM/%s.%s.app.dSYM" % (executable_name, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())))
dest_path = os.path.join(os.environ["PROJECT_DIR"], relative_dest_path)

print "moving %s to %s" % (src_path, dest_path)
shutil.move(src_path, dest_path)

if os.path.exists(dest_path):
sqlitedb = "/Applications/dSYM.app/Contents/Resources/dsym.db"
cx = sqlite3.connect(sqlitedb)
cu = cx.cursor()
cu.execute("""create table if not exists archives (file_path varchar(10) unique)""")
cu.execute("insert into archives values (?)", (dest_path, ))
cx.commit()
19 changes: 15 additions & 4 deletions dSYM.py
Expand Up @@ -10,6 +10,7 @@
from AHDropTarget import AHDropTarget
import os
import subprocess
import sqlite3

class AHFrame(wx.Frame):
def __init__(self, parent, title):
Expand All @@ -34,7 +35,6 @@ def __init__(self, parent, title):

#创建工具栏
toolbar = self.CreateToolBar()
#TODO: 图片改成相对路径
toolbar.AddSimpleTool(1, wx.Image('./about.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "关于我", "")
toolbar.AddSeparator()
toolbar.Realize() #准备显示工具栏
Expand All @@ -51,9 +51,11 @@ def __init__(self, parent, title):
self.vbox = wx.BoxSizer(wx.VERTICAL)


self.description = wx.StaticText(self.panel, -1, u'请将xcarchive文件拖拽到窗口中并选中任意一个版本进行分析', style=wx.TE_WORDWRAP | wx.TE_MULTILINE)
self.description = wx.StaticText(self.panel, -1, u'请将dSYM文件拖拽到窗口中并选中任意一个版本进行分析', style=wx.TE_WORDWRAP | wx.TE_MULTILINE)
self.fileTypeLB = wx.ListBox(self.panel, -1, style = wx.LB_EXTENDED)
self.fileTypeLB.SetBackgroundColour(wx.Colour(232, 232, 232, 255))
#TODO: 从sqlite中读取文件路径
self.getdSYMFileFromSqlite()
self.Bind(wx.EVT_LISTBOX, self.ListBoxClick, self.fileTypeLB)
self.Bind(wx.EVT_LISTBOX_DCLICK, self.ListBoxClick, self.fileTypeLB)

Expand All @@ -64,7 +66,7 @@ def __init__(self, parent, title):
self.vbox.SetItemMinSize(self.fileTypeLBhbox, (200, 100))
self.vbox.Add((-1, 10))

self.UUIDString = wx.StaticText(self.panel, -1, u'选中xcarchive的UUID:')
self.UUIDString = wx.StaticText(self.panel, -1, u'选中dSYM文件的UUID:')
self.vbox.Add(self.UUIDString, 0, wx.EXPAND | wx.ALL, 5)

self.UUIDStringText = wx.TextCtrl(self.panel, -1)
Expand Down Expand Up @@ -159,6 +161,15 @@ def OnMotion(self, event):
def ShowFileType(self):
self.fileTypeLB.Set(list([os.path.basename(filepath) for filepath in self.filesList]))

def getdSYMFileFromSqlite(self):
if os.path.exists('dsym.db'):
cx = sqlite3.connect('dsym.db')
cu = cx.cursor()
##查询
cu.execute("select * from archives")
self.filesList = [dsym[0] for dsym in cu.fetchall()]
self.ShowFileType()

#获取最后需要的文件地址
def getFilePath(self, rootPath):
if rootPath.endswith("dSYM"):
Expand All @@ -184,7 +195,7 @@ def OnAboutMe(self, event):
aboutMe.ShowModal()
aboutMe.Destroy()

versions = '1.0.0'
versions = '1.0.1'
if __name__ == '__main__':
app = wx.App(redirect=False)
frame = AHFrame(None, 'dSYM文件分析工具' + versions)
Expand Down
Binary file added dsym.db
Binary file not shown.
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -10,11 +10,11 @@

APP = ['dSYM.py']
OPTIONS = {
'includes': ['about.png'],
#'includes': ['about.png'],
'iconfile': 'dSYMIcns.icns',
'plist': {'CFBundleShortVersionString': '0.1.0',}
'plist': {'CFBundleShortVersionString': '1.0.1', }
}
DATA_FILES = ['about.png', 'avatar.jpg']
DATA_FILES = ['about.png', 'avatar.jpg', 'dsym.db', 'RunScript.py']

setup(
app = APP,
Expand Down

0 comments on commit 7142039

Please sign in to comment.