Sunday, February 28, 2016

DraftSightをインストール

http://www.3ds.com/jp/products/draftsight/download-draftsight/ からubuntu用をダウンロードして、ソフトウェアセンターで開いてインストールする。
起動して、アクティブ化画面でメアドを登録してアクティブ化する。

日本語の入力ができない(入力メソッドが切り替わらない)ので、他のエディタからコピーペーストするしか無いが、それ以外は問題なさそう・・・でも

1.モデル空間に原寸で書け。といっても、鎖線のピッチ、文字の大きさまで縮尺を考慮して変えておかないとダメ。
2.DXF変換するなら、図枠まですべてをモデル空間に書いておかないといけない。

1は文字や図枠はシート空間に1/1で書く。って方法もあるけど、一点鎖線や点線までシート空間には書けんだろ。
2はデータ交換できるのが、今や大前提なので、1の部分回避策もムダな努力

使うなら、用紙サイズと縮尺のすべての組み合わせで、テンプレートを作っておくんだろうね。そして、ご自慢のシート空間は一切つかわない。と

autocadがダメなんだろうけど、たいへんだな。

建築屋が、「でかいビルの平面図を分割して、紙の図面にするから、図枠をシート空間に書くと都合が良い」って書いてたけど、データ交換できないし。なにかいい方法があるんだろうか。

2016/4/5 追記
シート空間を表示しておいて、DXFで書き出すと、そのシートだけのDXF図面ができるようなので、問題点の2はクリアできるね。(AUTOCADは知らんけど)

Sunday, January 10, 2016

S.M.A.R.T情報を見るために「ディスク」をインストール

MATE版には無いので、synapticからdisk-utilityで検索して、gnome-disk-utilityをインストールする。
「メニュー」→「アクセサリ」→「ディスク」で起動
HDDを選択した後、右上の横縞アイコンを左クリック→「SMART のデータとセルフテスト」をクリック。
同様に「ドライブの設定」で、ドライブのスタンバイ、APM、書き込みキャッシュの設定ができる。

Thursday, December 17, 2015

Libreoffice base と 毛筆フォントをインストール

$ sudo apt-get install libreoffice-base fonts-kouzan-mouhitsu

でインストール


wowow PC再設定

パソコンでご利用の場合は、下記URLにアクセスの上、「パソコンで
視聴される方へ・パソコン用サイトへ >>」からご利用ください。

【WOWOWメンバーズオンデマンド・登録方法】
http://www.wowow.co.jp/mod/entry/

Tuesday, December 15, 2015

Firefoxでuser agent変更とpipelightインストール

Firefoxのアドオン user-agent switcher をインストール(user agent switcher ("-"のあるなしの違いね)もあるけど、こっちはデフォルトボタンで元に戻せるのと最初から入っているUAが多い)

http://godira.blogspot.jp/2015/01/pipelight.html
と同様
あとで必要になるので、先にライセンスファイルを作っておく。
$ touch $HOME/.config/wine-wininet-installer.accept-license

ppaを入れ、インストールする。
$ sudo add-apt-repository ppa:pipelight/stable
$ sudo apt-get update
$ sudo apt-get install pipelight

ついで
$ sudo pipelight-plugin --update
$ sudo pipelight-plugin --enable silverlight

http://www.iis.net/media/experiencesmoothstreaming 

の下の方の映像が表示されればOK

Tuesday, October 27, 2015

Ubuntu MATE 15.10 にアップグレード

15.10が出たようなので、アップグレード。

メニュー→システム→システム管理→ソフトウェアの更新 からシステムを最新にするとアップグレードの案内が出る。

アップグレード開始。途中で「自動で再起動するか?」にチェックを入れて、続ける。

サポートされなくなったプログラムは削除する。

40分ほどで終了。再起動。

途中、wine のppa が無効化されたので、後で再設定の必要あり。

Sunday, October 25, 2015

SL300のHDD故障?

SL300のウィンドウズ10が立ち上がらなくなった。
リセットから1時間ほどで、「HDDの検査中です」が出て、半日しても進展が無いので、システム領域が壊れたと判断。

Win10はプロダクトキーを要求されてアップグレードできないので、リカバリーディスクを試すが、初期設定のセットアップに数時間かかり、その後、HDDにアクセスしたまま進展しなくなったのであきらめる。

幸い、以前にインストールしたLinuxMintとブートローダーが生きていたので、それを使うことにする。

このHDD、いつまで使えるか?

Monday, September 07, 2015

Ubuntu MATEのWineにカシミール3Dをインストール

http://www.kashmir3d.com/ のダウンロードページからスタータキットをダウンロード。
kas923sp.exe を右クリックの wine windowsプログラムローダーで開く。
「Gekko が無い」と言われたので、インストールする。
インストール時のチェック項目は文字化けしているので、すべてデフォルトのまますすめる。

スタートメニューの「その他」にメニューがあったり、デスクトップにアイコンが置かれたりするのがwindows流かな。

Saturday, June 27, 2015

アップデートエラー

ubuntu MATE15.04の自動アップデートでエラーがでた。
Unknown Error: '' ("The cache has no package named 'wine1.7-i386'") 
ググると
sudo apt-get updete
しろ、とあったのでやってみたが、変化無し。
エラーアイコンから、「アップデートを確認」。「すべてのアップデートをインストール」。をクリックしたら、wine1.7-amd64 他をインストールして直った。
2015/8/26 に同じエラー。同じ手順&再起動で復旧。

Friday, May 29, 2015

Github 登録

Github に登録してみる。
https://github.com にアクセス
sign up をクリック
名前とメールアドレス、パスワードを入力してアカウントを作る。
登録したメアドにメールが来るので、そこにアクセスして、コンファームする。

SSH keys の Add an SSH key を開いて、 Title に鍵の登録名を記入。
SSH-keyを作る。
S ssh-keygen
種パスフレーズを入力する。
$HOME/.ssh/id_rsa.pub をエディタで開いて、 Add an SSH key の key にコピペする。

create a new repo のボタンから新しいレポジトリを作成する。
レポ名を入れて、 Create repository ボタンで作成

端末でローカルの git リポジトリを作るフォルダに移って、
$ git init
$ git add ファイル名
$ git commit -m "first commit"
$ git remote add origin https://github.com/名前/レポ名.git
$ git push -u origin master

レポジトリの削除方法
削除したいレポのページで右側の settings をクリック
一番下の Delete this repository をクリック
消したい レポ名 を入力して、I understand the consequences, delete this repository をクリックで削除される。

Wednesday, May 27, 2015

Rust-lang インストール

Rust を入れるために、まず curl を Syaptic で入れる。
端末で、Downloads フォルダに移って、
$ curl -sSf -L https://static.rust-lang.org/rustup.sh > rustup.sh
(-sS:エラーメッセージのみ出力。-f:400番台のエラーでもエラー終了する。-L:リダイレクトに追従する)
$ sh rustup.sh
で、途中でパスワードを入れるだけで、インストール終了(rustc,cargo,rust-docs が /usr/local 以下に展開される)

動作確認は
$ rustc --version
アンインストールは
$ sh rustup.sh --uninstall  または $ sudo /usr/local/lib/rustlib/uninstall.sh

プログラムの作成は、端末で $HOME/rust に行って
$ cargo new  プログラム名 --bin
$ cd プログラム名
$ cargo build
$ cargo run
で $HOME/rust/プログラム名/target/debug/プログラム名 のバイナリ実行ファイルが実行されて、端末に Hello World! が出るはず。

Geany で $HOME/rust/src/main.rs を開く。
メニュー→ビルド→ビルドコマンドを設定 を開いて、Rustコマンドの3番目に Cargo build, コマンドに cargo build, コマンドを実行の実行を2番に移し、1番めに Cargo run, コマンドに cargo run --verbose を入れてOK

Sunday, May 17, 2015

git インストール

Synaptic で git をインストール (Ver2.1.4)

$ git --version
で確認
$ git config --global user.name "name"
$ git config --global user.email "email"
日本語ファイル名の文字化けを防ぐために
$ git config --global core.quotepath false
で設定
$ git config --list
で設定確認(git config -l でもOK)

Synaptic でgit-cola をインストール(Ver2.0.6)
(インストールリストには出ないが、これで git-dag も一緒に入る)

Saturday, May 16, 2015

UbuntuMATE15.04追加設定

Synaptic で python-tk, python3-tk をインストール

LibreWriterでツール→オプション→印刷の「PDFを標準の印刷ジョブフォーマットにする」のチェックを外す。(プリンタで印刷のため)

GRUBのtimeout時間を変更
$ sudo pluma /etc/default/grub
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=4
(4秒にする)
$ sudo update-grub

Synaptic で Geany をインストール

windowsのテキストファイルを開くために leafpad をインストールする。

キーボードでのサスペンド復帰を無効にする。
lsinput を使うため、
$ sudo apt-get install input-utils
(不要なプログラムは $ sudo apt-get autoremove で削除する)

キーボード、マウスの接続先をさがす。
$ sudo lsinput

keyboard と USB の マウスレシーバを探すと、キーボードがevent2, マウスがevent3。

acpi のデバイス指定を確認する。
$ cat /proc/acpi/wakeup

PS2K がキーボード
event3 の phys の値と比較して、 XHC がマウス。

起動時にキーボードによる復帰を無効にするため
$ sudo pluma /etc/rc.local

r=`cat /proc/acpi/wakeup | grep "PS2K\s*\w\+\s*\*enabled"`
  if [ -n "$r" ] ; then
    echo PS2K > /proc/acpi/wakeup
 fi

を記入する。

Friday, May 15, 2015

Firefox の設定

Preference

  General
Always check if Firefox is your default browser  :nocheck
既定のブラウザにする。
When Firefox starts: Show my windows and tabs from last time
HomePage:  http://www.google.com/
Downloads  Save files to:  Downloads  :check
Always ask me where to save files  :nocheck

  Tabs
Open new windows in a nwe tabs insted  :check
Warn me when closing multiple tabs  :nocheck
Warn me when opening multiple tabs might slow down Firefox  :check
Don't load until selected  :check
When I open a link in a nwe tab, switch to it immediately  :check

  Search

  Content
Block pop-up windows  :check

  Applications

  Privacy
Tell sites that I do not want to be tracked  :nocheck
History
Firefox will: Use custom settings for history
Always use private browsing mode  :nocheck
Remember my browsing and download history  :check
Remember search and form history  :check
Accept cookies from sites  :check
Accept third-party cookies: Always
Keep until: I close Firefox
Clear history when Firefox closes  :nocheck
Location Bar
History  :check
Bookmarks  :check
Open tabs  :check

  Security
Warn when sites try to install add-ons  :check
Block reported attak sites  :check
Block reported web forgeries  :check
Passwords
Remember passwords for sites  :nocheck
Use a master password  :nocheck

  Sync
sync は Bookmarks のみ :check
Device Name: kawa's Firefox on z87m

  Advanced
General
Always use the cursor keys to navigate within pages  :nocheck
Serch for text when start typing  :nocheck
Warn me when websites try to redirect or reload the page  :check
Use autoscrolling  :nocheck
Use smooth scrolling  :check
Use hardware acceleration when available  :check
Check my spelling as 1type  :nocheck
Data Choices
Enable Firefox Health Report  :check
Enable Crash Reporter  :check
Network
Override automatic cache management  :check
Limit cache to  :350 MB of space
Tell me when a website asks to store data for offline use  :check
Update
Search Engines  :check
Certificates
Select one automatically  :nocheck
Ask me every time  :check
Query OCSP responder servers to confirm the current validity of certificates  :check

UbuntuMATE15.04を新規インストール

U-MATE15.04を落として、USBに焼いて、インストール。
ホームフォルダ以下を英文に。
$ LANG=C xdg-user-dirs-gtk-update
で、Don't ask me this again にチェックを入れて、Update Names する。

パネルを下1行にするために、
$ mate-panel --reset --layout redmond
(パネルが消えるので、もう一度同じコマンドを入力)
(元に戻すには
$ mate-panel --reset --layout ubuntu-mate
)

日本語入力を設定
$ sudo apt-get update
$ sudo apt-get install fcitx-mozc fcitx-anthy
$ im-config -n fcitx
(fcitx-anthy はいらないかも)

メニュー→システム→設定→ルック&フィール→外観の設定のカスタマイズで
コントロール ー> Redmond (端末が白ベースになる)
 ウィンドウの境界 ー> Winme
 アイコン ー> 霧
 Depotから壁紙ファイルを ~/Customize/Wallpaper にコピーして、背景タブで追加して設定する。

メニュー→システム→設定→MATE Tweakのウィンドウで
外観のボタンレイアウトを Contemporary(Left) にする。

wineを入れる(最新版)
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update
$ sudo apt-get install wine1.7
(下と右の矢印キーで「了解」を反転させてEnter。左矢印キーで「はい」を反転させてEnter)
 Depotから,データ、 .thunderbird, .wine のフォルダーを戻す。
jwwを起動すると、いろいろ足りないと言ってくるので、インストールする。

https://www.virtualbox.org/wiki/Downloads
から、VBをいれ、Extension Pack を入れる。
Depotから VirtualBox VMs, .VirtualBox を戻す。
DKMSが入っているか確認
$ dkms status
入っていなければ、入れる。
$ sudo apt-get install dkms
その後
$ sudo /etc/init.d/vboxdrv setup
(先にdkms を入れてから、VB を入れればOKかもしれない)

コントロールセンター→スクリーンセーバーの設定で
テーマ: ブランクスクリーン
アイドルまでの時間: 10分
アイドルになったらスクリーンセーバーを起動: check
スクリーンセーバー起動で画面ロック: nocheck

プリンタドライバのインストール
端末で、ダウンロードしたフォルダに移動する。
プリンタの電源を入れ、
sudo ./install.sh
でインストール開始。

接続方法:2 ネットワーク
プリンタの選択:1 Canon MG3500 series
プリンタの名前:MG3530LAN
通常使うプリンタに設定:y


ソフトウェアセンタはうざいので、Synapticをソフトウェアセンタで入れる。

Thursday, April 23, 2015

GeanyでPython2とPython3を使い分ける

GeanyでPythonプログラムを書いて実行させると、Python2で動く。(シェバンは無効)

Python3で動かすには、Geanyのメニューのビルド→ビルドコマンドの設定を開いて、

Pythonコマンドの2のラベルに「Py3コンパイル」、
コマンドに「python3 -c "import py_compile; py_compile.compile('%f')" 」

コマンドを実行の2のラベルに「Py3実行」、コマンドに「python3 "%f"」

を書き込んで、OKで設定する。

Python3で実行するときは、F5やギヤのアイコンでなく、メニューの ビルド→Py3実行 で行う。

Tuesday, April 07, 2015

LibreOffice Writerだけ印刷できない

Mint17で他のアプリケーションからは普通に印刷できるのに、Writerで印刷すると、白紙のまま出てくる。

Writerのメニューの、ツール→オプション→印刷で「PDFを標準の印刷ジョブフォーマットに」のチェックを外して再起動すると、 印刷できた。

Saturday, April 04, 2015

和時計


pythonで時計のプログラムを作ってみた。
python2系とTkinterが必要です、インストールしてください。
テストはLinuxMintでしか、してません。

特徴は
1.24時間表示で12時方向が昼の12時(図は午後7時56分38秒)
2.日の出、日の入り、南中時刻を表示(日の出5時24分、日の入り午後6時3分、南中11時44分)
3.大きさをマウスで変更可(root.minsizeからroot.maxsizeまで)

まずファイルをエディタで開いて、最初の方にある、「この場所のデータ」をお住まいの緯度、経度、標高に書き換えてください。
下のリストで「<」は「<」(半角)、「>」は「>」(半角)に書き換えてください。


#! /usr/bin/python
# coding: UTF-8

import Tkinter as tk
import math, time, datetime

# この場所のデータ
la = 34.8   # 緯度(度)。北緯は+,南緯は-
lo = 140.0  # 経度(度)。東経は+,西経は-
alt = 0.0   # 標高(m)
tdiff = 9.0   # グリニッジ標準時との時差

# グローバル変数
win_size = 200
backboard = []
rad = math.pi/180

# 太陽計算インターバルのための初期化
start_time = time.localtime()
h_old = start_time[3]
h = h_old + 1

# 三角関数を度で計算
def sind(d):
    return math.sin(d*rad)
def cosd(d):
    return math.cos(d*rad)
def tand(d):
    return math.tan(d*rad)
   
# Julius year の計算(2000/1/1からの時間)
def jy(yy, mm, dd, h, m, s, tdiff):
    yy -= 2000
    if mm <= 2 :
        mm += 12
        yy -= 1
    k = 365 * yy + 30 * mm + dd - 33.5 - tdiff / 24.0 + math.floor(3 * (mm + 1) / 5.0) \
    + math.floor(yy / 4.0) - math.floor(yy / 100.0) + math.floor(yy / 400.0)
    k += ((s / 60.0 + m) / 60.0 + h) / 24.0  # 時間をたす
    k += (65 + yy) / 86400.0  # delta T をたす
    return k / 365.25

# 太陽位置1 (celestial longitude, degree)
def spls(t):  # t Julius
    l = 280.4603 + 360.00769 * t \
    + (1.9146 - 0.00005 * t) * sind(357.538 + 359.991 * t) \
    + 0.0200 * sind(355.05 +  719.981 * t) \
    + 0.0048 * sind(234.95 +   19.341 * t) \
    + 0.0020 * sind(247.1  +  329.640 * t) \
    + 0.0018 * sind(297.8  + 4452.67  * t) \
    + 0.0018 * sind(251.3  +    0.20  * t) \
    + 0.0015 * sind(343.2  +  450.37  * t) \
    + 0.0013 * sind( 81.4  +  225.18  * t) \
    + 0.0008 * sind(132.5  +  659.29  * t) \
    + 0.0007 * sind(153.3  +   90.38  * t) \
    + 0.0007 * sind(206.8  +   30.35  * t) \
    + 0.0006 * sind( 29.8  +  337.18  * t) \
    + 0.0005 * sind(207.4  +    1.50  * t) \
    + 0.0005 * sind(291.2  +   22.81  * t) \
    + 0.0004 * sind(234.9  +  315.56  * t) \
    + 0.0004 * sind(157.3  +  299.30  * t) \
    + 0.0004 * sind( 21.1  +  720.02  * t) \
    + 0.0003 * sind(352.5  + 1079.97  * t) \
    + 0.0003 * sind(329.7  +   44.43  * t)
    while l >= 360 :
        l -= 360
    while l < 0 :
        l += 360
    return l

# 太陽位置2 (distance, AU)
def spds(t):  # t Julius
    r = (0.007256 - 0.0000002 * t) * sind(267.54 + 359.991 * t) \
    + 0.000091 * sind(265.1 +  719.98 * t) \
    + 0.000030 * sind( 90.0) \
    + 0.000013 * sind( 27.8 + 4452.67 * t) \
    + 0.000007 * sind(254   +  450.4  * t) \
    + 0.000007 * sind(156   +  329.6  * t)
    r = math.pow(10, r)
    return r

# 太陽位置3 (declination, degree)
def spal(t):  # t Julius
    ls = spls(t)
    ep = 23.439291 - 0.000130042 * t
    al = math.atan(tand(ls) * cosd(ep)) * 180.0 / math.pi
    if ls >= 0 and ls < 180 :
        while al < 0 :
            al += 180
        while al >= 180 :
            al -= 180
    else :
        while al < 180 :
            al += 180
        while al >= 360 :
            al -= 180
    return al

# 太陽位置4 (the right ascension, degree)
def spdl(t):  # t Julius
    ls = spls(t)
    ep = 23.439291 - 0.000130042 * t
    dl = math.asin(sind(ls) * sind(ep)) * 180.0 / math.pi
    return dl

# Calculate sidereal hour (degree)
def sh(t, h, m, s, l, tdiff):  # t julius, h hour, m minute, s second, l longitude, tdiff time difference
    d = ((s / 60.0 + m) / 60.0 + h) / 24.0  # elapsed hour (from 0:00 a.m)
    th = 100.4606 + 360.007700536 * t + 0.00000003879 * t * t - 15.0 * tdiff
    th += l + 360.0 * d
    while th >= 360 :
        th -= 360
    while th < 0 :
        th += 360
    return th

# Calculating the seeming horizon altitude "sa"(degree)
def eandp(alt, ds):  # subfunction for altitude and parallax
    e = 0.035333333 * math.sqrt(alt)
    p = 0.002442818 / ds
    return p - e

def sa(alt, ds):  # alt: altitude (m), ds: solar distance (AU)
    s = 0.266994444 / ds
    r = 0.585555555
    k = eandp(alt, ds) - s - r
    return k

# Calculating solar alititude (degree)
def soal(la, th, al, dl):  # la latitude, th sidereal hour, al solar declination, dl right ascension
    h = sind(dl) * sind(la) + cosd(dl) * cosd(la) * cosd(th - al)
    h = math.asin(h) * 180.0 / math.pi
    return h

# Calculating solar direction (degree)
def sodr(la, th, al, dl):  # la latitude, th sidereal hour, al solar declination, dl right ascension
    t = th - al
    dc = - cosd(dl) * sind(t)
    dm = sind(dl) * sind(la) - cosd(dl) * cosd(la) * cosd(t)
    if dm == 0 :
        st = sind(t)
        if st > 0 :
            dr = -90
        if st == 0 :
            dr = 9999
        if st < 0 :
            dr = 90
    else :
        dr = math.atan(dc / dm) * 180.0 / math.pi
        if dm < 0 :
            dr += 180
    if dr < 0 :
        dr += 360
    return dr

# 今日の日の出日没時刻計算(sunrize_h 日の出時, sunrize_m 日の出分, sunset_h 日没時, sunset_m 日没分,
#                            meridian_h 南中時, meridiann_m 南中分)
def sunpos():
    global la, lo, alt, tdiff
    # 今日の年月日
    td = datetime.datetime.today()
    yy = td.year
    mm = td.month
    dd = td.day
   
    # 日の出、日没の計算
    t = jy(yy, mm, dd-1, 23, 59, 0, tdiff)
    th = sh(t, 23, 59, 0, lo, tdiff)
    ds = spds(t)
    ls = spls(t)
    alp = spal(t)
    dlt = spdl(t)
    pht = soal(la, th, alp, dlt)
    pdr = sodr(la, th, alp, dlt)
   
    for hh in range(0, 24):
        for m in range(0, 60):
            t = jy(yy, mm, dd, hh, m, 0, tdiff)
            th = sh(t, hh, m, 0, lo, tdiff)
            ds = spds(t)
            ls = spls(t)
            alp = spal(t)
            dlt = spdl(t)
            ht = soal(la, th, alp, dlt)
            dr = sodr(la, th, alp, dlt)
            tt = eandp(alt, ds)
            ts = sa(alt, ds)
            if pht < ts and ht > ts :
                sunrize_h = hh
                sunrize_m = m
            if pdr < 180 and dr > 180 :
                meridian_h = hh
                meridian_m = m
            if pht > ts and ht < ts :
                sunset_h = hh
                sunset_m = m
            pht = ht
            pdr = dr
    return (sunrize_h, sunrize_m, sunset_h, sunset_m, meridian_h, meridian_m)

# 24時時計
# メインウィンドウ
root = tk.Tk()
root.title(u'  和時計')
root.minsize(160, 160)
root.maxsize(400, 400)

# キャンバス
c0 = tk.Canvas(root, width = 200, height = 200, bg = 'lightblue')
c0.pack(expand = True, fill = tk.BOTH)

    # 時計下地
circle = c0.create_oval(5, 5, 195, 195, fill = 'lightgray', outline = 'lightgray')

    # 太陽マーク
def sun_mark():
    sun_r_h, sun_r_m, sun_s_h, sun_s_m, sun_me_h, sun_me_m = sunpos()
    # 夜
    sun_r = 18 - sun_r_h - sun_r_m / 60.0
    sunrize = sun_r * 15
    sun_s = 18 - sun_s_h - sun_s_m / 60.0
    sunset = sun_s * 15
    night = c0.create_arc(5, 5, win_size - 5, win_size - 5, start = sunrize, extent = 360 - sunrize + sunset, fill = 'darkgray', outline = 'darkgray')
    c0.tag_raise(night, circle)
    # 南中太陽
    k = 5 # 太陽マークの半径
    n = (24 - sun_me_h - sun_me_m / 60.0) * 15
    x = 100 * math.sin(rad * n)
    y = 100 * math.cos(rad * n)
    sun = c0.create_oval(x - k, y + k, x + k, y - k, fill = 'yellow', outline = 'yellow')
    return night, sun

    # 文字盤
dial0 = c0.create_text(100, 195, text = u'子', anchor = 's')
dial6 = c0.create_text(5, 100, text = u'卯', anchor = 'w')
dial12 = c0.create_text(100, 5, text = u'午', anchor = 'n')
dial18 = c0.create_text(195, 100, text = u'酉', anchor = 'e')

    # 目盛り
for i in range( 12 ):
    backboard.append(c0.create_line(i, i, 135, 135, width = 2.0))

    # 針
hour = c0.create_line(100, 100, 100, 60, fill = 'blue', width = 4.0)
min  = c0.create_line(100, 100, 100, 50, fill = 'green', width = 3.0)
sec  = c0.create_line(100, 100, 100, 45, fill = 'red', width = 2.0)

# 背景の描画
def draw_backboard():
    sun_r_h, sun_r_m, sun_s_h, sun_s_m, sun_me_h, sun_me_m = sunpos()
    r = win_size / 2
    # 円
    c0.coords(circle, 5, 5, win_size - 5, win_size - 5)
    # 夜
    c0.coords(night, 5, 5, win_size - 5, win_size - 5)
    # 南中太陽
    k = 5 # 太陽マークの半径
    n = (24 - sun_me_h - sun_me_m / 60.0) * 15
    x = r + (r - 30) * math.sin(rad * n)
    y = r + (r - 30) * math.cos(rad * n)
    c0.coords(sun, x - k, y + k, x + k, y - k)
        # 目盛(30度ピッチ)
    for i in range(12):
        n = i * 30
        x1 = r + (r - 25) * math.sin(rad * n)
        y1 = r + (r - 25) * math.cos(rad * n)
        x2 = r + (r - 25) * 4 / 5 * math.sin(rad * n)
        y2 = r + (r - 25) * 4 / 5 * math.cos(rad * n)
        c0.coords(backboard[i], x1, y1, x2, y2)
    # 文字盤
    c0.coords(dial0, r, win_size - 8)
    c0.coords(dial6, 10, r)
    c0.coords(dial12, r, 8)
    c0.coords(dial18, win_size - 8, r)

# 針を描く
def draw_hand():
    global win_size, rad, h, h_old
    t = time.localtime()
    r = win_size / 2
    rs = r * 7 / 10
    rm = r * 6 / 10
    rh = r * 5 / 10
    # 秒(1秒で6度)
    n = t[5] * 6
    x = r + rs * math.sin(rad * n)
    y = r - rs * math.cos(rad * n)
    c0.coords(sec, r, r, x, y)
    # 分(1分で6度+1秒で0.1度)
    n = t[4] * 6 + t[5] * 0.1
    x = r + rm * math.sin(rad * n)
    y = r - rm * math.cos(rad * n)
    c0.coords(min, r, r, x, y)
    # 時 (24時間表示で下が0時)
    h = t[3]
    h1 = h + 12
    n = h1 * 15 + t[4] * 0.25
    x = r + rh * math.sin(rad * n)
    y = r - rh * math.cos(rad * n)
    c0.coords(hour, r, r, x, y)
   
    sun = 0
    if h != h_old :
        sun = 1
    h_old = h
    return sun
   

# 大きさの変更
def change_size(event):
    global win_size
    w = c0.winfo_width()
    h = c0.winfo_height()
    if w < h:
        win_size = w
    else:
        win_size = h
    draw_backboard()
    sun_flag = draw_hand()

# 表示
def show_time():
    sun_flag = draw_hand()
    if sun_flag == 1 :
        night, sun = sun_mark()
        draw_backboard()
    root.after(1000, show_time)

# バインディング
root.bind('', change_size)

# 最初の起動

night, sun = sun_mark()
draw_backboard()
show_time()

# メインループ
root.mainloop()

# (C) 2015 SiRaKaWa
# 参考文献
# 太陽位置計算部分: www.hoshi-lab.info/env/solar.html
# 時計部分: www.geocities.jp/m_hiroi/light/pytk07.html
 


Thursday, March 12, 2015

Archlinuxの設定あれこれ

MATE ターミナルの背景が白だと黄色文字が読みにくいので黒にする。
 ターミナルを起動し、「編集」→「プロファイル」のDefaultを編集する。
「色」タブで、組み込みのスキームを「黒字に白文字」にする。

フォントを見やすくするために、ヒンティングとビットマップを無効化する。
$ sudo pulma /etc/fonts/conf.avail/71-no-embedded-bitmaps.conf
以下を入力
xml version="1.0"?>
<fontconfig>
  <match target="font">
    <edit mode="assign" name="embeddedbitmap">
      <bool>false</bool>
    </edit>
    <edit mode="assign" name="hintstyle">
       <const>hintnone</const>
    </edit>
  </match>
</fontconfig>
- See more at: http://archlinux-blogger.blogspot.jp/2013/08/arch-linux.html#sthash.MruwPoKn.dpuf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="font">
        <edit mode="assign" name="embeddedbitmap"> 
            <bool>false</boot>
        </edit>
        <edit mode="assign" name="hintstyle">
            <cont>hintnone</const>
        </edit>
    </match>
</fontconfig>

/etc/fonts/conf.d/にリンクを張る。
$ sudo ln -s /etc/fonts/conf.avail/71-no-embedded-bitmaps.conf /etc/fontsconf.d/71-no-embedded-bitmaps.conf


/etc/fonts/conf.avail/71-no-embedded-bitmaps.conf
/etc/fonts/conf.avail/71-no-embedded-bitmaps.confを作り、以下を記入。 - See more at: http://archlinux-blogger.blogspot.jp/2013/08/arch-linux.html#sthash.MruwPoKn.dpuf
/etc/fonts/conf.avail/71-no-embedded-bitmaps.confを作り、以下を記入。 - See more at: http://archlinux-blogger.blogspot.jp/2013/08/arch-linux.html#sthash.MruwPoKn.dpuf
/etc/fonts/conf.avail/71-no-embedded-bitmaps.confを作り、以下を記入。 - See more at: http://archlinux-blogger.blogspot.jp/2013/08/arch-linux.html#sthash.MruwPoKn.dpuf
takaoフォントのインストール
$ packer -S otf-takao
Proceed with installatio で y
Edit otf-takao PKGBUILD with $EDITOR? で n
Edit otf.install with $EDITOR? で y
:q で vi をぬける。
パッケージを作ったあと、パスワードを聞いてくるので、入力する。
インストールするか?に y

Firefoxのインストール

$ packer -S firefox-i18n-ja

Firefoxの設定でコンテンツタブの既定のフォントを「Takao P ゴシック」に、詳細設定のプロポーショナルを「ゴシック体」、明朝体を「Takao P明朝」、ゴシック体を「Takao Pゴシック」、等幅を「Takaoゴシック」にする。

ウィンドウの閉じるボタン等を左側へ移動
アプリケーション→システムツール→dconfエディターを起動
org/mate/marco/generalのbatton-layoutをclose,minimize,maximize:menuにする。
(:はウィンドウのタイトルが入る)

下のパネルを消し、上のパネルを下に持ってきて、右クリックの「パネルへ追加」でワークスペース切替器、ウィンドウの一覧、Network Monitor、を追加。

jdをインストール
$ packer -S jd
Edit PKGBUILDで n
コンパイルして、パッケージ化後パスワードを入れてインストール。

Thunderbirdのインストール
$ packer -S thunderbird-i18n-ja

Tuesday, March 10, 2015

Archlinuxの日本語化

端末で
$ sudo nano /etc/locale.conf
以下を入力。LANG=en...行は削除するかコメント行にする。

LANG=ja_JP.UTF-8

とりあえず使えるフォントを入れる。
$ sudo pacman -S otf-ipafont

Fcitxとmozc
$ sudo pacman -S fcitx-im fcitx-configtool fcitx-mozc

環境変数の設定
$ nano ~/.xprofile
以下を入力
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"

再起動してシステム→コントロールセンター→fcitxの設定の、
入力メソッドタブで左下の+ボタンからMozcを選択して追加する。

Firefoxのインストール
端末で
$ packer -S firefox-i18n-ja