تم کانکی چیه ؟ خیلی خوشم امده میخوامش
سلام. اون همش کانکی نیست
متاسفانه خیلی بلد نبودم کانکی رو تنظیم کنم. وسطش یه فضای خالی گذاشتم بعد اون ساعت گردالی رو انداختم اونجا !!!
ساعته screenlet هست
می بینی که چقد تنظیم کانکیم افتضاحه!:
کانکی:
background yes
use_xft yes
xftfont monospace:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual yes
own_window_argb_value 0
own_window_colour black
double_buffer yes
minimum_size 1 1
maximum_width 240
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color 433424
default_shade_color 000000
default_outline_color d9d7d6
alignment tr
gap_x 50
gap_y 50
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
color1 red
color2 gray
##############################################
# Output
##############################################
TEXT
CPU 0: $alignr${cpu cpu0}%
${cpubar cpu0}
CPU 1: $alignr${cpu cpu1}%
${cpubar cpu1}
CPU 2: $alignr${cpu cpu2}%
${cpubar cpu2}
CPU 3: $alignr${cpu cpu3}%
${cpubar cpu3}
RAM: $alignr$mem/$memmax
$membar
${font sans-serif:bold:size=9}SYSTEM ${hr 2}
${font sans-serif:normal:size=9}$sysname $kernel $machine
Host:$alignr$nodename
Uptime:$alignr$uptime
${font sans-serif:bold:size=9}TIME IN MY HOME ${hr 2}
${font sans-serif:normal:size=9}
${hr 2}
${font sans-serif:bold:size=9}TOP PROCESSES ${hr 2}
${font sans-serif:normal:size=9}${top_mem name 1}${alignr}${top mem 1} %
${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %
${hr 2}
بعد واسه ساعت هم اول باید از انبار screenlets رو نصب کنید. بعد از gnome-look بگردید circleclockscreenlet رو پیدا کنید و به svreenlet اضافش کنید.
بعد از طریق این ویکی
http://wiki.ubuntu.ir/wiki/Jcal بسته jcal و jdate رو نصب کنید و تو پوشه خانگیتون یه مسیر هست به اسم :
.screenlets/CircleClock
یک فایل پایتون هست که بجاش این رو بذارید و به همون اسم و همونجا ذخیرش کنید:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This application is released under the GNU General Public License
# v3 (or, at your option, any later version). You can find the full
# text of the license under http://www.gnu.org/licenses/gpl.txt.
# By using, editing and/or distributing this software you agree to
# the terms and conditions of this license.
# Thank you for using free software!
#SensorScreenlet (c) Whise <helder.fraga@hotmail.com>
import screenlets
from screenlets import sensors
from screenlets.options import FloatOption, BoolOption, StringOption, IntOption, ColorOption, FontOption
import cairo
import pango
import sys
import gobject
import math
import os
class CircleClockScreenlet(screenlets.Screenlet):
"""Circle Clock Screenlet."""
# default meta-info for Screenlets
__name__ = 'CircleClockScreenlet'
__version__ = '0.7'
__author__ = 'chh-gx7.deviantart.com'
__desc__ = 'Circle Clock Screenlet.'
# internals
__timeout = None
# settings
update_interval = 1
show_text = True
show_time24 = True
text_prefix = '<span size="xx-small" rise="10000"></span><b>'
text_suffix = '</b>'
text_font = "Sans 25"
font_name = "Sans"
font_size = 25
color_back = (1, 1, 1, 0.6)
color_front =(1, 1, 1, 0.9)
color_text = (1, 1, 1, 1)
color_hour = (1, 1, 1, 0.8)
color_seconds = (1, 1, 1, 0.7)
sensor = 'CircleClock'
hour = 0
min = 0
sec = 0
new_time = 0
day = ''
show_hour_ring = False
show_seconds_ring = False
radius = 86
y_position = 52
thin_line = 5
thick_line = 10
# constructor
def __init__(self,**keyword_args):
screenlets.Screenlet.__init__(self, width=200, height=200,
uses_theme=True, **keyword_args)
self.theme_name = "default"
# add default menu items
# add settings
self.add_options_group('Clock', 'Clock appearance options')
self.add_option(BoolOption('Clock', 'show_text',
self.show_text, 'Show Text', 'Show the text on the clock face.'))
self.add_option(BoolOption('Clock', 'show_time24',
self.show_time24, '24 Hour time', 'Show hours with 24 hour format'))
self.add_option(ColorOption('Clock','color_back',
self.color_back, 'Background color', 'Background color of clock ring'))
self.add_option(ColorOption('Clock','color_front',
self.color_front, 'Front color', 'Front color of clock ring'))
self.add_option(ColorOption('Clock','color_text',
self.color_text, 'Text color', 'Text color of date/time display'))
self.add_option(IntOption('Clock', 'radius',
self.radius, 'Radius',
'Radius of Front(minutes) circle', min=70, max=90))
self.add_option(IntOption('Clock', 'y_position',
self.y_position, 'Y position',
'Y position of Clock text', min=50, max=100))
self.add_option(IntOption('Clock', 'update_interval',
self.update_interval, 'Update interval',
'Update interval for clock in seconds', min=1, max=60))
self.add_options_group('Additional', 'Additional Clock appearance options')
self.add_option(BoolOption('Additional', 'show_hour_ring',
self.show_hour_ring, 'Show Hours circle', 'Show ring for hours additionally'))
self.add_option(ColorOption('Additional', 'color_hour',
self.color_hour, 'Hour color', 'Circle Color of Hour'))
self.add_option(BoolOption('Additional', 'show_seconds_ring',
self.show_seconds_ring, 'Show Seconds circle', 'Show ring for seconds additionally'))
self.add_option(ColorOption('Additional', 'color_seconds',
self.color_seconds, 'Seconds color', 'Circle Color of Seconds'))
self.add_options_group('Font', 'Font selection')
self.add_option(FontOption('Font', 'text_font',
self.text_font, 'Font lookup', 'Just lookup for fonts'))
self.add_option(StringOption('Font', 'font_name',
self.font_name, 'Font', 'Font of the clock text'), realtime=False)
self.add_option(IntOption('Font', 'font_size',
self.font_size, 'Size', 'Font size', min=10, max=26))
# init the timeout function
self.update_interval = self.update_interval
self.radius = 86
self.y_position = 52
# these will be additional options too?
self.thin_line = 5
self.thick_line = 10
def on_init(self):
self.add_default_menuitems()
# attribute-"setter", handles setting of attributes
def __setattr__(self, name, value):
# call Screenlet.__setattr__ in baseclass (ESSENTIAL!!!!)
screenlets.Screenlet.__setattr__(self, name, value)
# check for this Screenlet's attributes, we are interested in:
if name == "update_interval":
if value > 0:
self.__dict__['update_interval'] = value
if self.__timeout:
gobject.source_remove(self.__timeout)
self.__timeout = gobject.timeout_add(int(value * 1000), self.update)
else:
# TODO: raise exception!!!
self.__dict__['update_interval'] = 1
pass
# timeout-function
def update(self):
self.sensor = sensors.cal_get_local_date()
self.new_time = sensors.cal_get_time()
if self.show_time24 == False:
self.new_time = sensors.cal_get_time12()[0:8]
self.hour = sensors.cal_get_hour()
self.min = sensors.cal_get_minute()
self.sec = sensors.cal_get_second()
self.day = sensors.cal_get_day_name()
# ----------------------------------------------------------------------------------
month_dict = {1:'فروردین',
2:'اردیبهشت',
3:'خرداد',
4:'تیر',
5:'امرداد',
6:'شهریور',
7:'مهر',
8:'آبان',
9:'آذر',
10:'دی',
11:'بهمن',
12:'اسفند'}
os.system("jdate '+%Y-%m-%d %H:%M:%S' |tee /home/sajedrakhshani/.screenlets/CircleClock/time_in_my_home")
files = open('/home/sajedrakhshani/.screenlets/CircleClock/time_in_my_home', 'r')
times = files.readline()
files.close()
[date, time] = times.split(' ')
[year, month, day] = date.split('-')
# [hour, minute, sec] = time.split(':')
self.sensor = day + ' ' + month_dict[int(month)] + ' ' + year
# --------------------------------------------------------------------------------------
self.redraw_canvas()
return True
def on_draw(self, ctx):
ctx.scale(self.scale, self.scale)
# draw bg (if theme available)
ctx.set_operator(cairo.OPERATOR_OVER)
#always draw the hour ring with 12 hour format coz it's quicker readable.
h = int(sensors.cal_get_hour12())*30
m = int(self.min)*6 #draw whole minute ring within 60 minutes
s = int(self.sec)*6
#self.theme.draw_rounded_rectangle(ctx,0,0,100,self.width,self.height)
ctx.set_source_rgba(self.color_back[0],self.color_back[1],self.color_back[2],self.color_back[3])
ctx.set_line_width (self.thick_line)
ctx.arc (self.width/2,self.height/2,self.radius,0,math.pi*2) # Arc(cx, cy, radius, start_angle, stop_angle)
ctx.set_line_width (self.thick_line)
ctx.stroke ()
ctx.set_source_rgba(self.color_front[0],self.color_front[1],self.color_front[2],self.color_front[3])
try:
ctx.arc (self.width/2,self.height/2,self.radius,-math.pi/2,(m*math.pi)/180 -math.pi/2) # Arc(cx, cy, radius, start_angle, stop_angle)
if self.show_hour_ring == True:
ctx.stroke ()
ctx.set_source_rgba(self.color_hour[0],self.color_hour[1],self.color_hour[2],self.color_hour[3])
ctx.set_line_width (self.thin_line)
ctx.arc (self.width/2,self.height/2,self.radius-self.thin_line-2,-math.pi/2,(h*math.pi)/180 -math.pi/2)
if self.show_seconds_ring == True:
ctx.stroke ()
ctx.set_source_rgba(self.color_seconds[0],self.color_seconds[1],self.color_seconds[2],self.color_seconds[3])
ctx.set_line_width (self.thin_line)
ctx.arc (self.width/2,self.height/2,self.radius+self.thin_line+2,-math.pi/2,(s*math.pi)/180 -math.pi/2)
except:pass
#ctx.set_source_rgb (0.3, 0.2, 0.5) # Solid color
ctx.stroke ()
# draw text
if len(str(self.new_time))==7:
self.new_time = "0" + str(self.new_time)
if self.show_text == True:
ctx.set_source_rgba(self.color_text[0],self.color_text[1],self.color_text[2],self.color_text[3])
text = '<small><small><small>' + self.sensor + '</small></small></small>\n' + self.text_prefix + str(self.new_time) + self.text_suffix + '\n' + '<small><small><small>' + self.day + '</small></small></small>'
if self.theme:self.theme.draw_text(ctx,text, 0, self.y_position, self.font_name, self.font_size, self.width,pango.ALIGN_CENTER)
def on_draw_shape(self,ctx):
self.on_draw(ctx)
# If the program is run directly or passed as an argument to the python
# interpreter then create a Screenlet instance and show it
if __name__ == "__main__":
import screenlets.session
screenlets.session.create_session(CircleClockScreenlet)
در ضمن اسم کاربر من
sajedrakhshani
هست که بگرد تو کد بالا اسم کاربر خودت رو بذار!!!
بعد اسکرین لت و کانکی رو بذار جای مناسب و رنگ مناسب. همین.
-----
فکر کنم کانکی رو تنظیم میکردم سریع تر بود!
----------------------------------------
سپاس از آقای بهزادی واسه صفحه ویکی. و همینطور آقای امیر صمیمی واسه معرفی jdate