Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix 'hitbox' issues and dockify the layout

  • Loading branch information...
commit 25771b72d34c7a5b8edc437e28542642de7e679f 1 parent b2ecf78
@ShadowKyogre authored
View
296 astrowidgets.py
@@ -20,6 +20,8 @@
('North Node','South Node'),\
('Ascendant','Descendant','MC','IC'))
+### CSS Themable Custom Widgets
+
class AstroClock(QtGui.QWidget):
def __init__(self, *args):
QtGui.QWidget.__init__(self, *args)
@@ -295,23 +297,24 @@ def drawHours(self, painter, circle):
trans=QtGui.QColor("#000000")
trans.setAlpha(0)
painter.setBrush(trans)
- off=datetime.now(tz.gettz())-self.hours.get_date(0)
- overall=self.nexts-self.hours.get_date(0)
+ phm=self.hours.tree.model().sourceModel()
+ off=datetime.now(tz.gettz())-phm.get_date(0)
+ overall=self.nexts-phm.get_date(0)
for i in xrange(24):
- top=self.hours.get_date(i)-self.hours.get_date(0)
+ top=phm.get_date(i)-phm.get_date(0)
offp=off.total_seconds()/overall.total_seconds()
percent=top.total_seconds()/overall.total_seconds()
if i == 23:
- width=self.nexts-self.hours.get_date(i)
+ width=self.nexts-phm.get_date(i)
else:
- width=self.hours.get_date(i+1)-self.hours.get_date(i)
+ width=phm.get_date(i+1)-phm.get_date(i)
w=width.total_seconds()/overall.total_seconds()*360
angle=(360*(percent-offp)+self.signData[1][0].m.projectedLon)%360.0
put=(angle+w/2)%360
painter.drawPie(circle, angle*16, w*16)
p=self.getPointAt(circle,put)
self.adjustPoint(p,put)
- icon=self.icons[str(self.hours.get_planet(i))]
+ icon=self.icons[str(phm.get_planet(i))]
icon.paint(painter,QtCore.QRect(p.x(),p.y(),20,20))
painter.restore()
@@ -385,7 +388,7 @@ def paintEvent(self, paintevent):
self.drawPlanets(painter, self.signData[1], self.outer_circle)
self.drawPlanets(painter, self.natData[1], self.inner_circle)
- dt=self.hours.get_planet(0)
+ dt=self.hours.tree.model().sourceModel().get_planet(0)
ic=self.icons[str(dt)]
ic.paint(painter,self.centerRect.toRect())
@@ -582,10 +585,148 @@ def paintCell(self, painter, rect, date):
icon=self.icons[phase]
icon.paint(painter,QtCore.QRect(rect.x(),rect.y(),14,14))
+# Special Models for planetary and moon phase stuff
+
#http://doc.qt.nokia.com/stable/qhelpcontentwidget.html
#http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qthelp.html
#http://ubuntuforums.org/showthread.php?t=1110989
#http://www.commandprompt.com/community/pyqt/x6082
+class BookMarkedModel(QtGui.QStandardItemModel):
+ def __init__(self, rows = 0, columns = 0, parent = None):
+ QtGui.QStandardItemModel.__init__(self, rows, columns, parent)
+ color=QtGui.QPalette().color(QtGui.QPalette.Midlight)
+ color.setAlpha(64)
+ self.color=QtGui.QBrush(color)
+ c2=QtGui.QPalette().color(QtGui.QPalette.Base)
+ c2.setAlpha(0)
+ self.base=QtGui.QBrush(c2)
+ self.last_index=0
+
+ def clear(self):
+ self.removeRows(0,self.rowCount())
+ self.last_index=0
+
+ def _highlight_row(self, idx):
+ for i in xrange(self.columnCount()):
+ self.item(idx, i).setBackground(self.color)
+
+ def _unhighlight_row(self, idx):
+ for i in xrange(self.columnCount()):
+ self.item(idx, i).setBackground(self.base)
+
+class PHModel(BookMarkedModel):
+ def __init__(self, parent = None):
+ BookMarkedModel.__init__(self, parent=parent,columns=2)
+ self.setHorizontalHeaderLabels(["Time","Planet"])
+
+ def grab_nearest_hour(self,date):
+ for i in xrange(self.last_index,24):
+ if i+1 > 23:
+ looking_behind = self.get_date(i)
+ if looking_behind <= date:
+ self._highlight_row(i)
+ self._unhighlight_row(i-1)
+ self.last_index=i
+ return self.get_planet(i)
+ else:
+ looking_behind = self.get_date(i)
+ looking_ahead = self.get_date(i+1)
+ if looking_behind <= date and looking_ahead > date:
+ self._highlight_row(i)
+ if i != 0:
+ self._unhighlight_row(i-1)
+ self.last_index=i
+ return self.get_planet(i)
+ return "-Error-"
+
+ def get_planet(self,idx):
+ return self.item(idx, 1).data(0).toPyObject()
+
+ def get_date(self,idx):
+ return self.item(idx, 0).data(32).toPyObject()
+
+ @classmethod
+ def prepareHours(cls,date,observer,icon_source):
+ planetary_hours = hours_for_day(date,observer)
+ model=cls()
+ for ph in planetary_hours:
+ icon=icon_source[ph[1]]
+ if ph[2] is True:
+ status_icon=icon_source['daylight']
+ else:
+ status_icon=icon_source['nightlight']
+ newhouritem=QtGui.QStandardItem(status_icon,ph[0].strftime("%H:%M:%S - %m/%d/%Y"))
+ newhouritem.setData(QtCore.QVariant(ph[0]),32)
+ newplanetitem=QtGui.QStandardItem(icon,ph[1])
+ model.appendRow([newhouritem,newplanetitem])
+ return model
+
+class MPModel(BookMarkedModel):
+ def __init__(self, parent = None):
+ BookMarkedModel.__init__(self, columns=3, parent=parent)
+ self.setHorizontalHeaderLabels(["Time","Phase","Illumination"])
+
+ def highlight_cycle_phase(self,date):
+ for i in xrange(self.last_index,29):
+ self._unhighlight_row(i)
+ if i <= 27:
+ cycling=self.get_date(i)
+ cycling2=self.get_date(i+1)
+ if cycling.timetuple().tm_yday <= \
+ date.timetuple().tm_yday \
+ < cycling2.timetuple().tm_yday:
+ self._highlight_row(i)
+ self.last_index=i
+ break
+ else:
+ cycling=self.get_date(i)
+ if cycling.timetuple().tm_yday == date.timetuple().tm_yday:
+ self._highlight_row(i)
+ self.last_index=i
+ break
+
+ def get_date(self,idx):
+ return self.item(idx, 0).data(32).toPyObject()
+
+ @classmethod
+ def getMoonCycle(cls,date,icon_source,refinements=2):
+ moon_cycle=get_moon_cycle(date,refinements=refinements)
+ model=cls()
+ for mc in moon_cycle:
+ mptitem = QtGui.QStandardItem(icon_source[mc[1]],mc[0].strftime("%H:%M:%S - %m/%d/%Y"))
+ mppitem = QtGui.QStandardItem(mc[1])
+ mplitem = QtGui.QStandardItem(mc[2])
+
+ mptitem.setData(mc[0],32)
+ mppitem.setText(mc[1])
+ mplitem.setText(mc[2])
+ model.appendRow([mptitem,mppitem,mplitem])
+ return model
+
+### Planetary Hours and Moon Phase Widgets
+
+class MoonCycleList(QtGui.QTreeView):
+ def __init__(self, *args):
+
+ QtGui.QTreeView.__init__(self, *args)
+ self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
+ self.setRootIsDecorated(False)
+ self.setModel(MPModel())
+
+ def setIcons(self, icon_list):
+ self.icons=icon_list
+
+ def setRefinement(self, ref):
+ self.refinement=ref
+
+ def clear(self):
+ self.model().clear()
+
+ def highlight_cycle_phase(self,date):
+ self.model().highlight_cycle_phase(date)
+
+ def get_moon_cycle(self,date):
+ self.setModel(MPModel.getMoonCycle(date,self.icons,self.refinement))
class PlanetaryHoursList(QtGui.QWidget):
def __init__(self, parent = None):
@@ -596,12 +737,6 @@ def __init__(self, parent = None):
self.tree.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.tree.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tree.setRootIsDecorated(False)
- color=self.palette().color(QtGui.QPalette.Midlight)
- color.setAlpha(64)
- self.color=QtGui.QBrush(color)
- c2=self.palette().color(QtGui.QPalette.Base)
- c2.setAlpha(0)
- self.base=QtGui.QBrush(c2)
inputstuff=QtGui.QGridLayout()
inputstuff.addWidget(QtGui.QLabel("Hour type to filter"),0,0)
@@ -618,53 +753,23 @@ def __init__(self, parent = None):
inputstuff.addWidget(self.filter_hour,0,1)
hbox.addLayout(inputstuff)
hbox.addWidget(self.tree)
- model=QtGui.QStandardItemModel()
- model.setColumnCount(2)
- model.setHorizontalHeaderLabels(["Time","Planet"])
+ model=PHModel()
filter_model=QtGui.QSortFilterProxyModel()
filter_model.setSourceModel(model)
filter_model.setFilterKeyColumn(1)
self.tree.setModel(filter_model)
self.filter_hour.activated.connect(self.filter_hours)
self.filter_hour.setToolTip("Select the hour type you want to show.")
- self.last_index=0
def clear(self):
- model=self.tree.model().sourceModel()
- model.removeRows(0,24)
- self.last_index=0
-
- def get_planet(self,idx):
- return self.tree.model().sourceModel().item(idx, 1).data(0).toPyObject()
-
- def get_date(self,idx):
- return self.tree.model().sourceModel().item(idx, 0).data(32).toPyObject()
+ self.tree.model().sourceModel().clear()
def setIcons(self, icon_list):
self.icons=icon_list
def prepareHours(self,date,observer):
planetary_hours = hours_for_day(date,observer)
- model=self.tree.model().sourceModel()
- for i in xrange(0,24):
- icon=self.icons[planetary_hours[i][1]]
-
- if planetary_hours[i][2] is True:
- status_icon=self.icons['daylight']
- else:
- status_icon=self.icons['nightlight']
- newhouritem=QtGui.QStandardItem(status_icon,planetary_hours[i][0].strftime("%H:%M:%S - %m/%d/%Y"))
- newhouritem.setData(QtCore.QVariant(planetary_hours[i][0]),32)
- newplanetitem=QtGui.QStandardItem(icon,planetary_hours[i][1])
- model.insertRow(i,[newhouritem,newplanetitem])
-
- def _highlight_row(self, idx):
- self.tree.model().sourceModel().item(idx, 0).setBackground(self.color)
- self.tree.model().sourceModel().item(idx, 1).setBackground(self.color)
-
- def _unhighlight_row(self, idx):
- self.tree.model().sourceModel().item(idx, 0).setBackground(self.base)
- self.tree.model().sourceModel().item(idx, 1).setBackground(self.base)
+ self.tree.model().setSourceModel(PHModel.prepareHours(date,observer,self.icons))
def filter_hours(self,idx):
if 0 == idx:
@@ -673,30 +778,15 @@ def filter_hours(self,idx):
self.tree.model().setFilterFixedString(self.filter_hour.itemText(idx)) #set filter based on planet name
def grab_nearest_hour(self,date):
- for i in xrange(self.last_index,24):
- if i+1 > 23:
- looking_behind = self.get_date(i)
- if looking_behind <= date:
- self._highlight_row(i)
- self._unhighlight_row(i-1)
- self.last_index=i
- return self.get_planet(i)
- else:
- looking_behind = self.get_date(i)
- looking_ahead = self.get_date(i+1)
- if looking_behind <= date and looking_ahead > date:
- self._highlight_row(i)
- if i != 0:
- self._unhighlight_row(i-1)
- self.last_index=i
- return self.get_planet(i)
- return "-Error-"
+ return self.tree.model().sourceModel().grab_nearest_hour(date)
+
+### Sign stuff
class AspectTableDisplay(QtGui.QWidget):
def __init__(self, *args):
QtGui.QWidget.__init__(self, *args)
vbox=QtGui.QVBoxLayout(self)
-#orbs = { 'conjunction': 10.0,
+ #orbs = { 'conjunction': 10.0,
#'semi-sextile':3.0,
#'semi-square':3.0,
#'sextile':6.0,
@@ -754,27 +844,27 @@ def buildTable(self,at,sad,comparative=False):
for yod in sad[0]:
c=QtGui.QStandardItem(str(yod))
self.tableSpecial.setItem(i,0,c)
- i=i+1
+ i+=1
i=0
for gt in sad[1]:
d=QtGui.QStandardItem(str(gt))
self.tableSpecial.setItem(i,1,d)
- i=i+1
+ i+=1
i=0
for gc in sad[2]:
e=QtGui.QStandardItem(str(gc))
self.tableSpecial.setItem(i,2,e)
- i=i+1
+ i+=1
i=0
for tsq in sad[3]:
f=QtGui.QStandardItem(str(tsq))
self.tableSpecial.setItem(i,4,f)
- i=i+1
+ i+=1
i=0
for stellium in sad[4]:
g=QtGui.QStandardItem(str(stellium))
self.tableSpecial.setItem(i,3,g)
- i=i+1
+ i+=1
self.guiAspects.resizeRowsToContents()
self.guiAspects.resizeColumnsToContents()
self.guiSpecial.resizeRowsToContents()
@@ -827,6 +917,8 @@ def aspectsDialog(widget, zodiac, other_table, icons, \
sign_icons, pluto_alternate, admi, nodes, orbs):
info_dialog=QtGui.QDialog(widget)
info_dialog.setWindowTitle("Aspectarian")
+ print widget.parent()
+ print widget.parent().parent()
tabs=QtGui.QTabWidget(info_dialog)
aspects=AspectTableDisplay(info_dialog)
aspects.setIcons(icons)
@@ -1009,67 +1101,3 @@ def get_constellations(self,date, observer):
self.target_date=date
self.time.setTime(self.target_date.time())
-class MoonCycleList(QtGui.QTreeWidget):
- def __init__(self, *args):
-
- QtGui.QTreeWidget.__init__(self, *args)
- self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
- self.setRootIsDecorated(False)
- header=QtCore.QStringList()
- header.append("Time")
- header.append("Phase")
- header.append("Illumination")
- self.setHeaderLabels(header)
- self.setColumnCount(3)
- self.color=self.palette().color(QtGui.QPalette.Midlight)
- self.color.setAlpha(64)
- self.last_index=0
- c2=self.palette().color(QtGui.QPalette.Base)
- c2.setAlpha(0)
- self.base=QtGui.QBrush(c2)
-
- def setIcons(self, icon_list):
- self.icons=icon_list
-
- def setRefinement(self, ref):
- self.refinement=ref
-
- def _highlight_row(self, idx):
- self.topLevelItem(idx).setBackground(0,self.color)
- self.topLevelItem(idx).setBackground(1,self.color)
- self.topLevelItem(idx).setBackground(2,self.color)
-
- def _unhighlight_row(self, idx):
- self.topLevelItem(idx).setBackground(0,self.base)
- self.topLevelItem(idx).setBackground(1,self.base)
- self.topLevelItem(idx).setBackground(2,self.base)
-
- def highlight_cycle_phase(self,date):
- for i in xrange(self.last_index,29):
- self._unhighlight_row(i)
- if i <= 27:
- cycling=self.topLevelItem(i).data(0,32).toPyObject().toPyDateTime()
- cycling2=self.topLevelItem(i+1).data(0,32).toPyObject().toPyDateTime()
- if cycling.timetuple().tm_yday <= \
- date.timetuple().tm_yday \
- < cycling2.timetuple().tm_yday:
- self._highlight_row(i)
- self.last_index=i
- break
- else:
- cycling=self.topLevelItem(i).data(0,32).toPyObject().toPyDateTime()
- if cycling.timetuple().tm_yday == date.timetuple().tm_yday:
- self._highlight_row(i)
- self.last_index=i
- break
- def get_moon_cycle(self,date):
- moon_cycle=get_moon_cycle(date,refinements=self.refinement)
- for i in xrange (29):
- newmooncycleitem = QtGui.QTreeWidgetItem()
- newmooncycleitem.setData(0,32,QtCore.QVariant(QtCore.QDateTime(moon_cycle[i][0])))
- newmooncycleitem.setIcon(0,self.icons[moon_cycle[i][1]])
- newmooncycleitem.setText(0,moon_cycle[i][0].strftime("%H:%M:%S - %m/%d/%Y"))
- newmooncycleitem.setText(1,moon_cycle[i][1])
- newmooncycleitem.setText(2,moon_cycle[i][2])
- self.addTopLevelItem(newmooncycleitem)
-
View
237 main.py
@@ -34,100 +34,115 @@ def closeEvent(self, event):
self.hide()
event.ignore()
-class ChronosLNX(QtGui.QWidget):
+class ChronosLNX(QtGui.QMainWindow):
def __init__(self, parent=None):
- QtGui.QWidget.__init__(self, parent)
+ QtGui.QMainWindow.__init__(self, parent)
self.timer = QtCore.QTimer(self)
self.now = datetime.now().replace(tzinfo=tz.gettz())
self.make_settings_dialog()
self.make_save_for_date_range()
self.make_tray_icon()
self.setWindowTitle(CLNXConfig.APPNAME)
- #self.setFixedSize(840, 420)
self.houses,self.zodiac=get_signs(CLNXConfig.birthtime,CLNXConfig.baby,\
CLNXConfig.show_nodes,CLNXConfig.show_admi)
- self.mainLayout=QtGui.QGridLayout(self)
- self.leftLayout=QtGui.QVBoxLayout()
- self.rightLayout=QtGui.QVBoxLayout()
self.add_widgets()
self.timer.timeout.connect(self.update)
- #self.setWindowFlags(QtGui.Qt.WA_Window)
+ self.setDockNestingEnabled(True)
self.timer.start(1000)
def add_widgets(self):
##left pane
self.astroClock=AstroClock(self)
- self.leftLayout.addWidget(self.astroClock)
-
- self.calendar=AstroCalendar(self)
- self.make_calendar_menu()
+ self.setCentralWidget(self.astroClock)
+ self.todayOther=QtGui.QLabel()
- buttonbox=QtGui.QHBoxLayout()
- self.mainLayout.addLayout(self.leftLayout,0,0)
- self.mainLayout.addLayout(self.rightLayout,0,1)
- self.mainLayout.addLayout(buttonbox,1,0,1,2)
+ self.todayOther.setTextFormat(QtCore.Qt.RichText)
+ docktlabel=QtGui.QDockWidget(self)
+ docktlabel.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
+ docktlabel.setWidget(self.todayOther)
+ docktlabel.setWindowTitle("Info for Today")
+ self.addDockWidget(QtCore.Qt.RightDockWidgetArea,docktlabel)
+
+ dockcalendar=QtGui.QDockWidget(self)
+ dockcalendar.setFeatures(QtGui.QDockWidget.DockWidgetMovable|QtGui.QDockWidget.DockWidgetFloatable)
+ self.calendar=AstroCalendar(dockcalendar)
+ dockcalendar.setWidget(self.calendar)
+ self.addDockWidget(QtCore.Qt.RightDockWidgetArea,dockcalendar)
+ dockcalendar.setWindowTitle("Calendar")
+ self.make_calendar_menu()
- aspectsButton=QtGui.QPushButton("Aspects for Now",self)
- aspectsButton.clicked.connect(lambda: aspectsDialog(self, self.zodiac, CLNXConfig.natal_data[1], \
+ aspectsAction=QtGui.QAction(QtGui.QIcon.fromTheme("view-calendar-list"), 'Aspects for Now', self)
+ aspectsAction.triggered.connect(lambda: aspectsDialog(self, self.zodiac, CLNXConfig.natal_data[1], \
CLNXConfig.main_icons, CLNXConfig.sign_icons, \
CLNXConfig.pluto_alt, CLNXConfig.show_admi, CLNXConfig.show_nodes, CLNXConfig.orbs))
- aspectsButton.setIcon(QtGui.QIcon.fromTheme("view-calendar-list"))
- buttonbox.addWidget(aspectsButton)
- housesButton=QtGui.QPushButton("Houses for Now",self)
- housesButton.clicked.connect(lambda: housesDialog(self, self.houses, \
+ housesAction=QtGui.QAction(QtGui.QIcon.fromTheme("measure"), 'Houses for Now', self)
+ housesAction.triggered.connect(lambda: housesDialog(self, self.houses, \
CLNXConfig.capricorn_alt,CLNXConfig.sign_icons))
- housesButton.setIcon(QtGui.QIcon.fromTheme("view-calendar-list"))
- buttonbox.addWidget(housesButton)
-
- natalButton=QtGui.QPushButton("&View Natal Data",self)
- natalButton.clicked.connect(lambda: self.get_info_for_date(CLNXConfig.birthtime, birth=True))
- natalButton.setIcon(QtGui.QIcon.fromTheme("view-calendar-list"))
- buttonbox.addWidget(natalButton)
-
- saveRangeButton=QtGui.QPushButton("Save data from dates",self)
- saveRangeButton.clicked.connect(self.save_for_range_dialog.open)
- saveRangeButton.setIcon(QtGui.QIcon.fromTheme("document-save-as"))
- buttonbox.addWidget(saveRangeButton)
-
- settingsButton=QtGui.QPushButton("Settings",self)
- settingsButton.clicked.connect(self.settings_dialog.open)
- settingsButton.setIcon(QtGui.QIcon.fromTheme("preferences-other"))
- buttonbox.addWidget(settingsButton)
-
- helpButton=QtGui.QPushButton("Help",self)
- helpButton.clicked.connect(self.show_help)
- helpButton.setIcon(QtGui.QIcon.fromTheme("help-contents"))
- buttonbox.addWidget(helpButton)
-
- aboutButton=QtGui.QPushButton("About",self)
- aboutButton.clicked.connect(self.show_about)
- aboutButton.setIcon(QtGui.QIcon.fromTheme("help-about"))
- buttonbox.addWidget(aboutButton)
+
+ natalAction=QtGui.QAction(QtGui.QIcon.fromTheme("view-calendar-birthday"), '&View Natal Data', self)
+ natalAction.triggered.connect(lambda: self.get_info_for_date(CLNXConfig.birthtime, birth=True))
+
+ saveRangeAction=QtGui.QAction(QtGui.QIcon.fromTheme("document-save-as"), 'Save data from dates', self)
+ saveRangeAction.triggered.connect(self.save_for_range_dialog.open)
+
+ settingsAction=QtGui.QAction(QtGui.QIcon.fromTheme('preferences-other'), 'Settings', self)
+ settingsAction.triggered.connect(self.settings_dialog.open)
+
+ helpAction=QtGui.QAction(QtGui.QIcon.fromTheme('help-contents'), 'Help', self)
+ helpAction.triggered.connect(self.show_help)
+
+ aboutAction=QtGui.QAction(QtGui.QIcon.fromTheme('help-about'), 'About', self)
+ aboutAction.triggered.connect(self.show_about)
+
+ toolbar = self.addToolBar('Main')
+ toolbar.addAction(aspectsAction)
+ toolbar.addAction(housesAction)
+ toolbar.addAction(natalAction)
+ toolbar.addAction(saveRangeAction)
+ toolbar.addAction(settingsAction)
+ toolbar.addAction(helpAction)
+ toolbar.addAction(aboutAction)
##right pane
- dayinfo=QtGui.QHBoxLayout()
- self.todayPicture=QtGui.QLabel()
- self.todayOther=QtGui.QLabel()
+ #dayinfo=QtGui.QHBoxLayout()
+ #self.todayPicture=QtGui.QLabel()
- self.todayOther.setTextFormat(QtCore.Qt.RichText)
#dayinfo.addWidget(self.todayPicture)
- dayinfo.addWidget(self.todayOther)
+ #dayinfo.addWidget(self.todayOther)
+ dockhours=QtGui.QDockWidget(self)
+ dockhours.setFeatures(QtGui.QDockWidget.DockWidgetMovable|QtGui.QDockWidget.DockWidgetFloatable)
self.hoursToday=PlanetaryHoursList(self)
+ dockhours.setWindowTitle("Planetary Hours")
+ dockhours.setWidget(self.hoursToday)
+ self.addDockWidget(QtCore.Qt.RightDockWidgetArea,dockhours)
+ dockmoon=QtGui.QDockWidget(self)
+ dockmoon.setFeatures(QtGui.QDockWidget.DockWidgetMovable|QtGui.QDockWidget.DockWidgetFloatable)
self.moonToday=MoonCycleList(self)
+ dockmoon.setWindowTitle("Moon Phases")
+ dockmoon.setWidget(self.moonToday)
+ self.tabifyDockWidget(dockhours, dockmoon)
+ docksigns=QtGui.QDockWidget(self)
+ docksigns.setFeatures(QtGui.QDockWidget.DockWidgetMovable|QtGui.QDockWidget.DockWidgetFloatable)
self.signsToday=SignsForDayList(self)
+ docksigns.setWindowTitle("Signs")
+ docksigns.setWidget(self.signsToday)
+ self.tabifyDockWidget(dockmoon, docksigns)
+ dockevents=QtGui.QDockWidget(self)
+ dockevents.setFeatures(QtGui.QDockWidget.DockWidgetMovable|QtGui.QDockWidget.DockWidgetFloatable)
self.eventsToday=EventsList(self)
-
- dayData=QtGui.QTabWidget()
+ dockevents.setWindowTitle("Events")
+ dockevents.setWidget(self.eventsToday)
+ self.tabifyDockWidget(docksigns, dockevents)
self.update_widgets_config()
@@ -139,15 +154,6 @@ def add_widgets(self):
CLNXConfig.todays_schedule.setDate(self.now.date())
self.eventsToday.tree.setModel(CLNXConfig.todays_schedule)
- dayData.addTab(self.hoursToday,"Planetary Hours")
- dayData.addTab(self.moonToday,"Moon Phases")
- dayData.addTab(self.signsToday,"Signs")
- dayData.addTab(self.eventsToday,"Events")
-
- self.rightLayout.addLayout(dayinfo)
- self.rightLayout.addWidget(self.calendar)
- self.rightLayout.addWidget(dayData)
-
self.update()
def update_widgets_config(self):
@@ -251,30 +257,35 @@ def show_notification(self, title, text, ptrigger):
#http://eli.thegreenplace.net/2011/04/25/passing-extra-arguments-to-pyqt-slot/
def get_info_for_date(self, date, birth=False):
- info_dialog=QtGui.QDialog(self)
- info_dialog.setFixedSize(400,400)
- info_dialog.setWindowTitle("Info for %s" %(date.strftime("%m/%d/%Y")))
- info_dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
- vbox=QtGui.QVBoxLayout(info_dialog)
-
+ dateinfo="Info for %s" %(date.strftime("%m/%d/%Y"))
if birth:
ob=CLNXConfig.baby
- text="""Note: This is for the birth timezone %s and this time.
-If you want adjust your birth time, go to Settings.""" \
+ text=("\nNote: This is for the birth timezone %s and this time."
+ "\nIf you want adjust your birth time, go to Settings.") \
% CLNXConfig.birthtime.tzname()
- vbox.addWidget(QtGui.QLabel(text))
+ #vbox.addWidget(QtGui.QLabel(text))
else:
ob=CLNXConfig.observer
- #info_dialog.setFlags(QtCore.Qt.WA_DeleteOnClose)
-
- hoursToday=PlanetaryHoursList(info_dialog)
+ text=""
+ infotext="{dateinfo}{text}".format(**locals())
+ #infobox=QtGui.QDockWidget(self)
+ #infobox.setWidget(QtGui.QLabel(infotext))
+ #infobox.setWindowTitle("Date")
+ #self.addDockWidget(QtCore.Qt.LeftDockWidgetArea,infobox)
+
+ dockhours=QtGui.QDockWidget(self)
+ dockmoon=QtGui.QDockWidget(self)
+ docksigns=QtGui.QDockWidget(self)
+ dockevents=QtGui.QDockWidget(self)
+
+ hoursToday=PlanetaryHoursList(dockhours)
hoursToday.setIcons(CLNXConfig.main_icons)
- moonToday=MoonCycleList(info_dialog)
+ moonToday=MoonCycleList(dockmoon)
moonToday.setRefinement(CLNXConfig.refinements['Moon Phase'])
moonToday.setIcons(CLNXConfig.moon_icons)
- signsToday=SignsForDayList(info_dialog)
+ signsToday=SignsForDayList(docksigns)
signsToday.setIcons(CLNXConfig.main_icons)
signsToday.setSignIcons(CLNXConfig.sign_icons)
signsToday.setPlutoAlternate(CLNXConfig.pluto_alt)
@@ -285,14 +296,11 @@ def get_info_for_date(self, date, birth=False):
if not birth:
signsToday.setCompareTable(CLNXConfig.natal_data[1])
- eventsToday=EventsList(info_dialog)
+ eventsToday=EventsList(dockevents)
model=DayEventsModel()
model.setSourceModel(CLNXConfig.schedule)
model.setDate(date)
eventsToday.tree.setModel(model)
- eventsToday.setAttribute(QtCore.Qt.WA_DeleteOnClose)
-
- dayData=QtGui.QTabWidget(info_dialog)
hoursToday.prepareHours(date,ob)
moonToday.get_moon_cycle(date)
@@ -307,12 +315,25 @@ def get_info_for_date(self, date, birth=False):
else:
signsToday.get_constellations(date, ob)
- dayData.addTab(hoursToday,"Planetary Hours")
- dayData.addTab(moonToday,"Moon Phases")
- dayData.addTab(signsToday,"Signs")
- dayData.addTab(eventsToday,"Events")
- vbox.addWidget(dayData)
- info_dialog.show()
+ dockhours.setWindowTitle("Planetary Hours")
+ dockhours.setWidget(hoursToday)
+ self.addDockWidget(QtCore.Qt.LeftDockWidgetArea,dockhours)
+ dockhours.setToolTip(infotext)
+
+ dockmoon.setWindowTitle("Moon Phases")
+ dockmoon.setWidget(moonToday)
+ self.tabifyDockWidget(dockhours, dockmoon)
+ dockmoon.setToolTip(infotext)
+
+ docksigns.setWindowTitle("Signs")
+ docksigns.setWidget(signsToday)
+ self.tabifyDockWidget(dockmoon, docksigns)
+ docksigns.setToolTip(infotext)
+
+ dockevents.setWindowTitle("Events")
+ dockevents.setWidget(eventsToday)
+ self.tabifyDockWidget(docksigns, dockevents)
+ dockevents.setToolTip(infotext)
def make_save_for_date_range(self):
#self.save_for_range_dialog=QtGui.QDialog(self)
@@ -452,7 +473,7 @@ def print_to_file(self, option,date,filename=None,suppress_notification=False):
def get_cal_menu(self, qpoint):
table=self.calendar.findChild(QtGui.QTableView)
- idx=table.indexAt(qpoint)
+ idx=table.indexAt(table.mapFromParent(qpoint))
mdl=table.model()
if idx.column() > 0 and idx.row() > 0:
month=self.calendar.monthShown()
@@ -477,11 +498,21 @@ def get_cal_menu(self, qpoint):
if replace_month == 1:
date=datetime(year=year+1,\
month=replace_month,\
- day=day, tzinfo=tz.gettz())
+ day=day, hour=12, \
+ minute=0, second=0, \
+ tzinfo=tz.gettz())
else:
- date=datetime(year=year,\
+ if replace_month == 0:
+ date=datetime(year=year,month=12,\
+ day=day, hour=12, \
+ minute=0, second=0, \
+ tzinfo=tz.gettz())
+ else:
+ date=datetime(year=year,\
month=replace_month,\
- day=day, tzinfo=tz.gettz())
+ day=day, hour=12, \
+ minute=0, second=0, \
+ tzinfo=tz.gettz())
else:
date=datetime(year=year,month=month,day=day,\
hour=12,minute=0, second=0, tzinfo=tz.gettz())
@@ -885,7 +916,7 @@ def update(self):
self.trayIcon.setToolTip("%s - %s\n%s" %(self.now.strftime("%Y/%m/%d"), self.now.strftime("%H:%M:%S"),
total_string.replace("<br />","\n").replace("<sup>","").replace("</sup>","")))
self.trayIcon.setIcon(sysicon)
- self.todayPicture.setPixmap(CLNXConfig.main_pixmaps[str(self.phour)])
+ #self.todayPicture.setPixmap(CLNXConfig.main_pixmaps[str(self.phour)])
self.todayOther.setText("%s<br />%s" %(self.now.strftime("%H:%M:%S"), total_string))
def event_trigger(self, event_type, text, planet_trigger):
@@ -900,20 +931,21 @@ def event_trigger(self, event_type, text, planet_trigger):
def parse_phour_args(self,string):
alist=None
args=len(findall("%\(prev\)s|%\(next\)s", string))
+ model=self.hoursToday.tree.model().sourceModel()
if args == 2:
- if self.hoursToday.last_index > 0:
- idx=self.hoursToday.last_index - 1
+ if lidx > 0:
+ idx=lidx - 1
else:
- idx=self.hoursToday.last_index + 6
- prev_hour=self.hoursToday.get_planet(idx)
+ idx=lidx + 6
+ prev_hour=model.get_planet(model.last_index)
alist={'prev': prev_hour, "next": self.phour}
elif args == 1:
if match("%\(prev\)s"):
- if self.hoursToday.last_index > 0:
- idx=self.hoursToday.last_index - 1
+ if lidx > 0:
+ idx=lidx - 1
else:
- idx=self.hoursToday.last_index + 6
- prev_hour=self.hoursToday.get_planet(idx)
+ idx=lidx + 6
+ prev_hour=model.get_planet(model.last_index)
alist={"prev": prev_hour}
else:
alist={"next": self.phour}
@@ -955,7 +987,8 @@ def check_alarm(self):
hour_item.minute(), 0)
else:
if hour_item == "Every planetary hour":
- dt = self.hoursToday.get_date(self.hoursToday.last_index)
+ phm=self.hoursToday.tree.model().sourceModel()
+ dt = phm.get_date(phm.last_index)
hour_trigger=compare_to_the_second(self.now, dt.hour, dt.minute, dt.second+1)
if hour_trigger:
pt=True
View
4 measurements.py
@@ -110,7 +110,8 @@ def __repr__(self):
"\nStarts at %s"
"\nEnds at %s") %(self.num, self.cusp, self.end)
-class ZodiacalMeasurement:
+class ZodiacalMeasurement (object):
+ __slots__ = ('latitude','longitude')
def __init__(self, l, a):
self.longitude=l%360.0
self.latitude=a
@@ -183,6 +184,7 @@ def __eq__(self, zm):
return self.longitude==zm.longitude
class ActiveZodiacalMeasurement(ZodiacalMeasurement):
+ __slots__ = ('house_info','progress')
def __init__(self, l, a, house_info, progress=None):
ZodiacalMeasurement.__init__(self,l,a)
self.house_info=house_info
View
BIN  themes/DarkGlyphs/gui/close.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  themes/DarkGlyphs/gui/float.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
15 themes/DarkGlyphs/ui.css
@@ -1,4 +1,4 @@
-QWidget
+QWidget, QDockWidget::title
{
color: #0064FF;
background: qlineargradient(spread:pad,
@@ -6,11 +6,22 @@ QWidget
stop:0 #520000, stop:1 #000000);
}
-QCheckBox, QLabel, QGroupBox
+QToolBar
{
background: transparent;
}
+QCheckBox, QLabel, QGroupBox, QDockWidget::close-button, QDockWidget::float-button
+{
+ background: transparent;
+}
+
+QDockWidget
+{
+ titlebar-close-icon: url(skin:gui/close.png);
+ titlebar-normal-icon: url(skin:gui/float.png);
+}
+
QTabBar::tab
{
border-top-left-radius: 3px;
Please sign in to comment.
Something went wrong with that request. Please try again.