コード例 #1
0
ファイル: ruler.py プロジェクト: sanyaade-multimedia/skencil
    def update_colors(self):
        color = self.mw.get_style().bg[gtk.STATE_ACTIVE]
        self.border_color = [
            color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0
        ]

        r, g, b = self.border_color

        if system.get_os_family() == system.WINDOWS:
            color = self.get_style().base[gtk.STATE_NORMAL]
        else:
            color = self.get_style().bg[gtk.STATE_NORMAL]
        self.bg_color = [
            color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0
        ]

        r0, g0, b0 = self.bg_color

        if self.orient:
            self.grad = cairo.LinearGradient(0, 0, SIZE, 0)
            self.grad.add_color_stop_rgb(0, r0, g0, b0)
            self.grad.add_color_stop_rgb(1, r, g, b)
        else:
            self.grad = cairo.LinearGradient(0, 0, 0, SIZE)
            self.grad.add_color_stop_rgb(0, r0, g0, b0)
            self.grad.add_color_stop_rgb(1, r, g, b)

        if not config.ruler_style:
            self.border_color = [0, 0, 0]
コード例 #2
0
ファイル: ruler.py プロジェクト: sk1project/skencil
    def update_colors(self):
        color = self.mw.get_style().bg[gtk.STATE_ACTIVE]
        self.border_color = [color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0]

        r, g, b = self.border_color

        if system.get_os_family() == system.WINDOWS:
            color = self.get_style().base[gtk.STATE_NORMAL]
        else:
            color = self.get_style().bg[gtk.STATE_NORMAL]
        self.bg_color = [color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0]

        r0, g0, b0 = self.bg_color

        if self.orient:
            self.grad = cairo.LinearGradient(0, 0, SIZE, 0)
            self.grad.add_color_stop_rgb(0, r0, g0, b0)
            self.grad.add_color_stop_rgb(1, r, g, b)
        else:
            self.grad = cairo.LinearGradient(0, 0, 0, SIZE)
            self.grad.add_color_stop_rgb(0, r0, g0, b0)
            self.grad.add_color_stop_rgb(1, r, g, b)

        if not config.ruler_style:
            self.border_color = [0, 0, 0]
コード例 #3
0
ファイル: app_conf.py プロジェクト: tisn05/sk1
def get_app_config(path):
	os_family = system.get_os_family()
	if os_family == system.MACOSX:
		return MacosxConfig(path)
	elif os_family == system.WINDOWS:
		return WinConfig(path)
	else:
		return LinuxConfig(path)
コード例 #4
0
def get_app_config():
    os_family = system.get_os_family()
    if os_family == system.MACOSX:
        return MacosxConfig()
    elif os_family == system.WINDOWS:
        return WinConfig()
    else:
        return LinuxConfig()
コード例 #5
0
	def __init__(self, app, presenter):
		gtk.Table.__init__(self)
		self.app = app
		self.presenter = presenter
		self.caption = presenter.doc_name

		self.tab_caption = TabCaption(self, self.caption)

		da_box = gtk.Table(3, 3, False)

		self.corner = RulerCorner(self)
		da_box.attach(self.corner, 0, 1, 0, 1, gtk.SHRINK, gtk.SHRINK)

		self.hruler = Ruler(self, uc2const.HORIZONTAL)
		da_box.attach(self.hruler, 1, 3, 0, 1, gtk.EXPAND | gtk.FILL, gtk.SHRINK)

		self.vruler = Ruler(self, uc2const.VERTICAL)
		da_box.attach(self.vruler, 0, 1, 1, 3, gtk.SHRINK, gtk.EXPAND | gtk.FILL)

		hbox = gtk.HBox()
		line = gtk.VSeparator()
		hbox.pack_start(line, False, False, 0)
		self.v_adj = gtk.Adjustment()
		self.vscroll = gtk.VScrollbar(self.v_adj)
		hbox.pack_start(self.vscroll, True, True, 0)
		da_box.attach(hbox, 2, 3, 1, 2, gtk.SHRINK, gtk.EXPAND | gtk.FILL)

		vbox = gtk.VBox()
		line = gtk.HSeparator()
		vbox.pack_start(line, False, False, 0)

		hbox = gtk.HBox()
		sbox = gtk.VBox()
		self.h_adj = gtk.Adjustment()
		self.hscroll = gtk.HScrollbar(self.h_adj)
		sbox.pack_start(self.hscroll, False, True, 0)
		hbox.pack_end(sbox, True, True, 0)

		vbox.pack_start(hbox, True, True, 0)
		da_box.attach(vbox, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.SHRINK)

		self.canvas = AppCanvas(self)
		da_box.attach(self.canvas, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND,
			gtk.FILL | gtk.EXPAND, 0, 0)

		if system.get_os_family() == system.WINDOWS:
			xpad = 2; ypad = 0
		else:
			xpad = ypad = 0

		self.attach(da_box, 0, 1, 0, 1,
					gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
					xpadding=xpad, ypadding=ypad)
コード例 #6
0
    def __init__(self, app, presenter):
        gtk.Table.__init__(self)
        self.app = app
        self.presenter = presenter
        self.caption = presenter.doc_name

        self.tab_caption = TabCaption(self, self.caption)

        da_box = gtk.Table(3, 3, False)

        self.corner = RulerCorner(self)
        da_box.attach(self.corner, 0, 1, 0, 1, gtk.SHRINK, gtk.SHRINK)

        self.hruler = Ruler(self, 0)
        da_box.attach(self.hruler, 1, 3, 0, 1, gtk.EXPAND | gtk.FILL,
                      gtk.SHRINK)

        self.vruler = Ruler(self, 1)
        da_box.attach(self.vruler, 0, 1, 1, 3, gtk.SHRINK,
                      gtk.EXPAND | gtk.FILL)

        self.v_adj = gtk.Adjustment()
        self.vscroll = gtk.VScrollbar(self.v_adj)
        da_box.attach(self.vscroll, 2, 3, 1, 2, gtk.SHRINK,
                      gtk.EXPAND | gtk.FILL)

        self.h_adj = gtk.Adjustment()
        self.hscroll = gtk.HScrollbar(self.h_adj)
        da_box.attach(self.hscroll, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL,
                      gtk.SHRINK)

        self.canvas = AppCanvas(self)
        da_box.attach(self.canvas, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 0, 0)

        if system.get_os_family() == system.WINDOWS:
            xpad = 2
            ypad = 0
        else:
            xpad = ypad = 3

        self.attach(da_box,
                    0,
                    1,
                    0,
                    1,
                    gtk.EXPAND | gtk.FILL,
                    gtk.EXPAND | gtk.FILL,
                    xpadding=xpad,
                    ypadding=ypad)
コード例 #7
0
ファイル: docarea.py プロジェクト: mynameisdeleted/lincutter
	def __init__(self, app, presenter):
		gtk.Table.__init__(self)
		self.app = app
		self.presenter = presenter
		self.caption = presenter.doc_name

		self.tab_caption = TabCaption(self, self.caption)

		da_box = gtk.Table(3, 3, False)

		self.corner = RulerCorner(self)
		da_box.attach(self.corner, 0, 1, 0, 1, gtk.SHRINK, gtk.SHRINK)

		self.hruler = Ruler(self, 0)
		da_box.attach(self.hruler, 1, 3, 0, 1, gtk.EXPAND | gtk.FILL, gtk.SHRINK)

		self.vruler = Ruler(self, 1)
		da_box.attach(self.vruler, 0, 1, 1, 3, gtk.SHRINK, gtk.EXPAND | gtk.FILL)

		self.v_adj = gtk.Adjustment()
		self.vscroll = gtk.VScrollbar(self.v_adj)
		da_box.attach(self.vscroll, 2, 3, 1, 2, gtk.SHRINK, gtk.EXPAND | gtk.FILL)

		self.h_adj = gtk.Adjustment()
		self.hscroll = gtk.HScrollbar(self.h_adj)
		da_box.attach(self.hscroll, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.SHRINK)

		self.canvas = AppCanvas(self)
		da_box.attach(self.canvas, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND,
			gtk.FILL | gtk.EXPAND, 0, 0)

		if system.get_os_family() == system.WINDOWS:
			xpad = 2; ypad = 0
		else:
			xpad = ypad = 3

		self.attach(da_box, 0, 1, 0, 1,
					gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
					xpadding=xpad, ypadding=ypad)
コード例 #8
0
ファイル: ruler.py プロジェクト: sk1project/skencil
    def repaint(self, *args):
        if config.ruler_style:
            color = self.get_style().bg[gtk.STATE_ACTIVE]
            r = color.red / 65535.0
            g = color.green / 65535.0
            b = color.blue / 65535.0
        else:
            r = g = b = 0

        if system.get_os_family() == system.WINDOWS:
            bgcolor = self.get_style().base[gtk.STATE_NORMAL]
        else:
            bgcolor = self.get_style().bg[gtk.STATE_NORMAL]
        r0 = bgcolor.red / 65535.0
        g0 = bgcolor.green / 65535.0
        b0 = bgcolor.blue / 65535.0

        painter = self.window.cairo_create()
        painter.set_antialias(cairo.ANTIALIAS_NONE)
        painter.set_source_rgb(r0, g0, b0)
        painter.paint()
        painter.set_source_rgb(r, g, b)
        painter.set_line_width(1.0)
        painter.rectangle(-1, -1, SIZE, SIZE)
        painter.stroke()

        coord = self.origin
        painter.set_source_rgb(0, 0, 0)
        painter.set_line_width(1.0)
        for job in SIGN[coord]:
            if job[0]:
                painter.set_dash([], 0)
            else:
                painter.set_dash([0.2], 0)
            painter.move_to(job[1], job[2])
            painter.line_to(job[3], job[4])
            painter.stroke()
コード例 #9
0
ファイル: ruler.py プロジェクト: sanyaade-multimedia/skencil
    def repaint(self, *args):
        if config.ruler_style:
            color = self.get_style().bg[gtk.STATE_ACTIVE]
            r = color.red / 65535.0
            g = color.green / 65535.0
            b = color.blue / 65535.0
        else:
            r = g = b = 0

        if system.get_os_family() == system.WINDOWS:
            bgcolor = self.get_style().base[gtk.STATE_NORMAL]
        else:
            bgcolor = self.get_style().bg[gtk.STATE_NORMAL]
        r0 = bgcolor.red / 65535.0
        g0 = bgcolor.green / 65535.0
        b0 = bgcolor.blue / 65535.0

        painter = self.window.cairo_create()
        painter.set_antialias(cairo.ANTIALIAS_NONE)
        painter.set_source_rgb(r0, g0, b0)
        painter.paint()
        painter.set_source_rgb(r, g, b)
        painter.set_line_width(1.0)
        painter.rectangle(-1, -1, SIZE, SIZE)
        painter.stroke()

        coord = self.origin
        painter.set_source_rgb(0, 0, 0)
        painter.set_line_width(1.0)
        for job in SIGN[coord]:
            if job[0]:
                painter.set_dash([], 0)
            else:
                painter.set_dash([0.2], 0)
            painter.move_to(job[1], job[2])
            painter.line_to(job[3], job[4])
            painter.stroke()
コード例 #10
0
ファイル: resmngr.py プロジェクト: sahwar/sk1-wx
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <https://www.gnu.org/licenses/>.

import os, shutil

from uc2.utils import generate_id
from uc2.utils.system import WINDOWS, get_os_family
from uc2.formats.pdxf import const

OS_FAMILY = get_os_family()


def convert_resource_path(path):
    if OS_FAMILY == WINDOWS:
        path = path.replace('/', '\\')
    return path


class ResourceManager:
    """
    Represents resource manager object to
    manage files included into PDXF file archive. 
    """
    def __init__(self, presenter):
        self.presenter = presenter
コード例 #11
0
#
#  You should have received a copy of the GNU Affero General Public License
#  along with this program.  If not, see <https://www.gnu.org/licenses/>.

import errno
import logging
import os
import sys

from uc2 import _, events, msgconst
from uc2.utils import system

LOG = logging.getLogger(__name__)

# Platform
IS_MSW = system.get_os_family() == system.WINDOWS
IS_MAC = system.get_os_family() == system.MACOSX

HOME = os.path.expanduser(u'~')


def expanduser(path=''):
    if path.startswith('~'):
        path = path.replace('~', HOME)
    return path


def normalize_path(path):
    return os.path.abspath(expanduser(path))

コード例 #12
0
def get_app_config():
    os_mapping = {system.MACOS: MacosxConfig, system.WINDOWS: WinConfig}
    return os_mapping.get(system.get_os_family(), LinuxConfig)()
コード例 #13
0
ファイル: resmngr.py プロジェクト: Scrik/sk1-wx
#	
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#	
#	You should have received a copy of the GNU General Public License
#	along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os, shutil

from uc2.utils import generate_id
from uc2.utils.system import WINDOWS, get_os_family
from uc2.formats.pdxf import const

OS_FAMILY = get_os_family()

def convert_resource_path(path):
	if OS_FAMILY == WINDOWS:
		path = path.replace('/', '\\')
	return path

class ResourceManager:
	"""
	Represents resource manager object to
	manage files included into PDXF file archive. 
	"""

	def __init__(self, presenter):
		self.presenter = presenter
		self.doc_dir = presenter.doc_dir