Dig into code base and Refine the trac feeds
2010-06-01 00:21 Tower Joo 阅读(943) 评论(0) 编辑 收藏 举报Dig into code base and Refine the trac feeds
The passed week was very busy to me, since the graduation reply. I'm happy that I am about to graduate from the 19 years schooling career, which is really long. A new start to me, and a new start since then.
Following the last week's plan, I went on the refinement of Trac feeds plugin and have made the following tuning:
- fault tolerance
The main work went to the fault tolerance, and the UI refinement was rejected at last since it's hard to make a balance between good UI and complex implementation.
And besides that, I started to read the source code of touch screen. Since it's based on Django, I follow the approach of the common Django apps, i.e. urls -> views -> models->templates.
Let's begin the journey.
core/urls.py
After digging into the urls.py, it's easy to know each installed plugins will be shown in loalhost/ or localhost/display/, which dispatches the request to display function at core/views.py.core/views.py
To simplify the analysis, I will omit some files and logics.
Let's focus on the display function, which render the django dict variables to the corresponding template display.html. The rendered dict includes:
- 'screens':PLUGIN_MANAGER['ScreenManager'].plugins
- rc = RequestContext(request, processors=[plugin_processor, settings_processor])
- 'screen_animations':PLUGIN_MANAGER['ScreenAnimationManager'].plugins
RequestContext will make the plugin_manager and each plugin's setting available to the template.
and also the screens(plugins) and corresponding animation will be available.
Then let's go to the template.
core/display.html
In this file, it will load the needed javascript/css to make the infrastructure.
{% for key, screen in screens.items %}
<div id='{{screen.hash}}' class='screen'>
{% with screen.hash as screenHash %}
{% include screen.template %}
{% endwith %}
</div>
{% endfor %}
And the above code snippet will include each screen's specific html into the main html.
Screen's specific html
Each screen's specific html will decide what content will be put in the screen(plugin) and how it can be shown and also you can write the control commands(key events and etc.) to ease the navigate.
This portion should obey the conversion which is defined by the touch screen.
Summary
Till now I only get a big picture of the architecture of touch screen, and some details are still in front me which needs to catch, including:
- other control approaches(twisted and so on)
- the complex class hierarchy
- the plugin system
- the menu system
- thread syncing mechanism
And after reading some codes, I found some not-so-good codes, e.g. the main html(display.html), in which lots of jquery plugins are included in and most of them are not used in most of the plugins. And also when I try to read the codes of some screen examples, and I found some jquery plugin codes, and I try to figure out which plugin this function belongs to but finally I found it's really difficult to locate the function. IMO, we can refactor the main html and remove the not-necessary jquery codes and include them in the specific plugin template if the screen html really needs it.
plan
I will finish my graduation reply this Thursday and will have plenty of time to work on GSoC.My plan will base on my proposal and also will make some adjustment from mentor's advices.
For the new week, I will:
- read codes
- understand the plugin system
- understand the menu system
- understand the twisted interface
- do some preparation for this ticket http://trac.osuosl.org/trac/touchscreen/ticket/12
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· SQL Server 2025 AI相关能力初探
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库